本文整理汇总了PHP中VmViewAdmin::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP VmViewAdmin::__construct方法的具体用法?PHP VmViewAdmin::__construct怎么用?PHP VmViewAdmin::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmViewAdmin
的用法示例。
在下文中一共展示了VmViewAdmin::__construct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
// Insert our standard javascript and css into the head
$document = JFactory::getDocument();
// Jquery validation
$document->addStyleSheet(JURI::base() . "components/com_virtuemart/views/mds/tmpl/css/screen.css");
$document->addScript(JURI::base() . "components/com_virtuemart/views/mds/tmpl/js/jquery.validate.min.js");
// Date Time Picker
$document->addStyleSheet(JURI::base() . "components/com_virtuemart/views/mds/tmpl/datetimepicker-master/jquery.datetimepicker.css");
$document->addScript(JURI::base() . "components/com_virtuemart/views/mds/tmpl/datetimepicker-master/jquery.datetimepicker.js");
// Our custom js and css
$document->addScript(JURI::base() . "components/com_virtuemart/views/mds/tmpl/js/mds_collivery.js");
$document->addStyleSheet(JURI::base() . "components/com_virtuemart/views/mds/tmpl/css/mds_collivery.css");
// Our base url
$document->addScriptDeclaration('base_url = "' . JURI::base() . '";');
// Load the database and execute our sql file
$this->db = JFactory::getDBO();
// Get information of our plugin so we can pass it on to MDS Collivery for Logs
$sel_query = "SELECT * FROM `#__extensions` where type = 'plugin' and element = 'mds_shipping' and folder = 'vmshipment';";
$this->db->setQuery($sel_query);
$this->db->query();
$this->extension_id = $this->db->loadObjectList()[0]->extension_id;
$this->app_name = $this->db->loadObjectList()[0]->extension_id;
$this->app_info = json_decode($this->db->loadObjectList()[0]->manifest_cache);
// Get our login information
$config_query = "SELECT * FROM `#__mds_collivery_config` where id = 1;";
$this->db->setQuery($config_query);
$this->db->query();
$this->password = $this->db->loadObjectList()[0]->password;
$this->username = $this->db->loadObjectList()[0]->username;
$this->risk_cover = $this->db->loadObjectList()[0]->risk_cover;
$version = new JVersion();
require_once preg_replace('|com_installer|i', "", JPATH_COMPONENT_ADMINISTRATOR) . '/helpers/config.php';
$this->vm_version = VmConfig::getInstalledVersion();
$config = array('app_name' => $this->app_info->name, 'app_version' => $this->app_info->version, 'app_host' => "Joomla: " . $version->getShortVersion() . ' - Virtuemart: ' . VmConfig::getInstalledVersion(), 'app_url' => JURI::base(), 'user_email' => $this->username, 'user_password' => $this->password);
// Use the MDS API Files
require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Cache.php';
require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/Mds/Collivery.php';
$this->collivery = new Mds\Collivery($config);
// Get some information from the API
$this->towns = $this->collivery->getTowns();
$this->services = $this->collivery->getServices();
$this->location_types = $this->collivery->getLocationTypes();
$this->addresses = $this->collivery->getAddresses();
$this->default_address_id = $this->collivery->getDefaultAddressId();
$this->default_contacts = $this->collivery->getContacts($this->default_address_id);
$this->mds_services = $this->collivery->getServices();
// Class for converting lengths and weights
require_once JPATH_PLUGINS . '/vmshipment/mds_shipping/UnitConvertor.php';
$this->converter = new UnitConvertor();
}