public static function getDetails() { $bannersObj = new SJB_Banners(); $bannerGroups = $bannersObj->getAllBannerGroups(); $bannersList = array(); foreach ($bannerGroups as $bannerGroup) { $bannersList[] = array('id' => $bannerGroup['sid'], 'caption' => $bannerGroup['id']); } $details = parent::getDetails(); $additionalDetails = array(array('id' => 'approve_by_admin', 'caption' => 'Approve Banners by Admin', 'type' => 'boolean', 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 7.5), array('id' => 'banner_group_sid', 'caption' => 'Banner Group', 'type' => 'list', 'length' => '20', 'list_values' => $bannersList, 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 0), array('id' => 'width', 'caption' => 'Required Width', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'height', 'caption' => 'Required Height', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 2), array('id' => 'recurring', 'caption' => '', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => '0', 'caption' => 'One-time payment'), array('id' => '1', 'caption' => 'Recurring Subscription')), 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 0), array('id' => 'price', 'caption' => 'Price', 'type' => 'float', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'period', 'caption' => 'Period', 'type' => 'integer', 'validators' => array('SJB_PlusValidator'), 'length' => '20', 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'period_name', 'caption' => 'Period', 'type' => 'list', 'length' => '20', 'list_values' => array(array('id' => 'unlimited', 'caption' => 'Unlimited'), array('id' => 'week', 'caption' => 'Week(s)'), array('id' => 'month', 'caption' => 'Month(s)'), array('id' => 'year', 'caption' => 'Year(s)')), 'table_name' => 'products', 'is_required' => true, 'is_system' => true, 'order' => 3)); $details = array_merge($details, $additionalDetails); return $details; }
public function execute() { $bannersObj = new SJB_Banners(); $errors = array(); $tp = SJB_System::getTemplateProcessor(); if (isset($_REQUEST['action'])) { $action_name = $_REQUEST['action']; $params = $_REQUEST; switch ($action_name) { case 'delete_banner_group': $result = $bannersObj->deleteBannerGroup($params['groupSID']); if ($result === false) { $errors[] = 'ERROR_DELETING_BANNER_GROUP'; } break; } $site_url = SJB_System::getSystemsettings('SITE_URL') . '/manage-banner-groups/'; header("Location: {$site_url}"); } $bannerGroups = $bannersObj->getAllBannerGroups(); $tp->assign('errors', $errors); $tp->assign('bannerGroups', $bannerGroups); $tp->display('manage_banner_groups.tpl'); }