function editForm($tpl = null) { $helper = new adagencyAdminHelper(); jimport("joomla.database.table.user"); require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'sajax.php'; $db = JFactory::getDBO(); $advertiser = $this->get('advertiser'); $isNew = $advertiser->aid < 1; $text = $isNew ? JText::_('New') : JText::_('Edit'); JToolBarHelper::title(JText::_('AD_EDIT_ADV') . ":<small>[" . $text . "]</small>"); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { JToolBarHelper::cancel('cancel', 'Close'); } $user = new JUser(); if (!$isNew) { $user->load($advertiser->user_id); } $this->assign("user", $user); $this->assign("advertiser", $advertiser); if (isset($_SESSION['ad_country'])) { $advertiser->country = $_SESSION['ad_country']; } $configs = $this->_models['adagencyconfig']->getConfigs(); if (isset($configs->show)) { $show = explode(";", $configs->show); } else { $show = NULL; } if (isset($configs->mandatory)) { $mandatory = explode(";", $configs->mandatory); } else { $mandatory = NULL; } if (count($show) >= 2) { unset($show[count($show) - 1]); } if (count($mandatory) >= 2) { unset($mandatory[count($mandatory) - 1]); } $configs->show = $show; $configs->mandatory = $mandatory; $country_option = $helper->get_country_options($advertiser, false, $configs); $lists['country_option'] = $country_option; $profile = new StdClass(); $profile->country = $advertiser->country; $profile->state = $advertiser->state; if (isset($_SESSION['ad_state']) && $_SESSION['ad_state'] != '') { $advertiser->state = $_SESSION['ad_state']; } $shipcountry_option = $helper->get_country_options($advertiser, true, $configs); $lists['shipcountry_options'] = $shipcountry_option; $lists['customerlocation'] = $helper->get_store_province($advertiser); $profile = new StdClass(); $profile->country = $advertiser->shipcountry; $profile->state = $advertiser->state; $lists['customershippinglocation'] = $helper->get_store_province($profile, true, $configs); //check for plugins $sqls = "SELECT count(*) FROM #__ad_agency_plugins"; $db->setQuery($sqls); $exists = $db->loadResult(); if (intval($exists) > 0) { $content = $this->_models['adagencyplugin']->getPluginOptions($advertiser->paywith); $lists['paywith'] = $content; } else { $lists['paywith'] = '<select name="payment_type"></select>'; $lists['paywith'] .= " Please upload payment plugins"; } //end check // Create status list if ($isNew) { $status_selected = 'Y'; } else { $status_selected = $advertiser->approved; } $sts_select = new StdClass(); $sts_select->status = JText::_("ADAG_SEL_STS"); $sts_select->value = ''; $sts_approve = new StdClass(); $sts_approve->status = JText::_("VIEWADVERTISERAPPROVED"); $sts_approve->value = "Y"; $sts_decline = new StdClass(); $sts_decline->status = JText::_("ADAG_DECLINED"); $sts_decline->value = "N"; $sts_pending = new StdClass(); $sts_pending->status = JText::_("ADAG_PENDING"); $sts_pending->value = 'P'; $statuses[] = $sts_select; $statuses[] = $sts_approve; $statuses[] = $sts_decline; $statuses[] = $sts_pending; $lists['approved'] = JHTML::_('select.genericlist', $statuses, 'approved', 'class="inputbox" size="1"', 'value', 'status', $status_selected); // if ($user->block=='1') $isenabled='0'; else $isenabled='1'; //$lists['enabled'] = JHTML::_('select.booleanlist', 'enabled', '', $isenabled ); $this->assign("lists", $lists); $this->assign("configs", $configs); parent::display($tpl); }
function editForm($tpl = null) { $helper = new adagencyAdminHelper(); $my = JFactory::getUser(); //echo "<pre>";var_dump($my);die(); require_once JPATH_SITE . DS . 'components' . DS . 'com_adagency' . DS . 'helpers' . DS . 'sajax.php'; $db = JFactory::getDBO(); $advertiser = $this->get('Advertiser'); //echo "<pre>";var_dump($advertiser);die(); $isNew = $advertiser->aid < 1; $text = $isNew ? JText::_('New') : JText::_('Edit'); //BUG registered users jimport("joomla.database.table.user"); $user = new JUser(); if (!$isNew) { $user->load($advertiser->user_id); } $itemid = $this->getModel("adagencyConfig")->getItemid('adagencyadvertisers'); $itemid_cpn = $this->getModel("adagencyConfig")->getItemid('adagencycpanel'); $this->assign("itemid_cpn", $itemid_cpn); $configs = $this->get('Conf'); if (isset($configs->show)) { $show = explode(";", $configs->show); } else { $show = NULL; } if (isset($configs->mandatory)) { $mandatory = explode(";", $configs->mandatory); } else { $mandatory = NULL; } if (count($show) >= 2) { unset($show[count($show) - 1]); } if (count($mandatory) >= 2) { unset($mandatory[count($mandatory) - 1]); } $configs->show = $show; $configs->mandatory = $mandatory; $this->assign("conf", $configs); $this->assign("user", $user); $this->assign("advertiser", $advertiser); if (isset($_SESSION['ad_country'])) { $advertiser->country = $_SESSION['ad_country']; } $configs = $this->_models['adagencyconfig']->getConfigs(); $country_option = $helper->get_country_options($advertiser, false, $configs); //echo "<pre>";var_dump($country_option);die(); $lists['country_option'] = $country_option; $query = "SELECT country FROM #__ad_agency_states GROUP BY country ORDER BY country ASC"; $db->setQuery($query); $countries = $db->loadObjectList(); //echo "<pre>";var_dump($countries);die(); $profile = new StdClass(); $profile->country = $advertiser->country; $profile->state = $advertiser->state; if (isset($_SESSION['ad_state']) && $_SESSION['ad_state'] != '') { $advertiser->state = $_SESSION['ad_state']; } $shipcountry_option = $helper->get_country_options($advertiser, true, $configs); $lists['shipcountry_options'] = $shipcountry_option; $lists['customerlocation'] = $helper->get_store_province($advertiser); $profile = new StdClass(); $profile->country = $advertiser->shipcountry; $profile->state = $advertiser->state; $lists['customershippinglocation'] = $helper->get_store_province($profile, true, $configs); $content = $this->_models['adagencyplugin']->getPluginOptions($advertiser->paywith); $lists['paywith'] = $content; $captch = $configs->captcha; $this->assign("is_captcha", $captch); $this->assign("lists", $lists); $this->assign("itemid", $itemid); parent::display($tpl); }