本文整理汇总了PHP中AdminController::initContent方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminController::initContent方法的具体用法?PHP AdminController::initContent怎么用?PHP AdminController::initContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminController
的用法示例。
在下文中一共展示了AdminController::initContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initContent
public function initContent()
{
if ((empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') && Configuration::get('PS_SSL_ENABLED')) {
// You can uncomment these lines if you want to force https even from localhost and automatically redirect
// header('HTTP/1.1 301 Moved Permanently');
// header('Location: '.Tools::getShopDomainSsl(true).$_SERVER['REQUEST_URI']);
// exit();
$clientIsMaintenanceOrLocal = in_array(Tools::getRemoteAddr(), array_merge(array('127.0.0.1'), explode(',', Configuration::get('PS_MAINTENANCE_IP'))));
// If ssl is enabled, https protocol is required. Exception for maintenance and local (127.0.0.1) IP
if ($clientIsMaintenanceOrLocal) {
$this->errors[] = Tools::displayError('SSL is activated. However, your IP is allowed to use unsecure mode (Maintenance or local IP).');
} else {
$warningSslMessage = Tools::displayError('SSL is activated. Please connect using the following url to log in in secure mode (https).');
$warningSslMessage .= '<a href="https://' . Tools::safeOutput(Tools::getServerName()) . Tools::safeOutput($_SERVER['REQUEST_URI']) . '">https://' . Tools::safeOutput(Tools::getServerName()) . Tools::safeOutput($_SERVER['REQUEST_URI']) . '</a>';
$this->context->smarty->assign(array('warningSslMessage' => $warningSslMessage));
}
}
if (file_exists(_PS_ADMIN_DIR_ . '/../install') || file_exists(_PS_ADMIN_DIR_ . '/../admin')) {
$this->context->smarty->assign(array('randomNb' => rand(100, 999), 'wrong_folder_name' => true));
}
// Redirect to admin panel
if (Tools::isSubmit('redirect') && Validate::isControllerName(Tools::getValue('redirect'))) {
$this->context->smarty->assign('redirect', Tools::getValue('redirect'));
} else {
$tab = new Tab((int) $this->context->employee->default_tab);
$this->context->smarty->assign('redirect', $this->context->link->getAdminLink($tab->class_name));
}
if ($nb_errors = count($this->errors)) {
$this->context->smarty->assign(array('errors' => $this->errors, 'nbErrors' => $nb_errors, 'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')), 'disableDefaultErrorOutPut' => true));
}
$this->setMedia();
$this->initHeader();
parent::initContent();
$this->initFooter();
}
示例2: initContent
public function initContent()
{
$this->errors[] = Tools::displayError('Controller not found');
$tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
$this->context->smarty->assign($tpl_vars);
parent::initContent();
}
示例3: initContent
public function initContent()
{
$this->errors[] = $this->trans('Controller not found', array(), 'Admin.Notifications.Error');
$tpl_vars['controller'] = Tools::getvalue('controllerUri', Tools::getvalue('controller'));
$this->context->smarty->assign($tpl_vars);
parent::initContent();
}
示例4: initContent
public function initContent()
{
if ($this->action == 'select_delete') {
$this->context->smarty->assign(array('delete_form' => true, 'url_delete' => htmlentities($_SERVER['REQUEST_URI']), 'boxes' => $this->boxes));
}
parent::initContent();
}
示例5: initContent
public function initContent()
{
parent::initContent();
$this->addJqueryPlugin('cooki-plugin');
$data = Shop::getTree();
foreach ($data as $key_group => &$group) {
foreach ($group['shops'] as $key_shop => &$shop) {
$current_shop = new Shop($shop['id_shop']);
$urls = $current_shop->getUrls();
foreach ($urls as $key_url => &$url) {
$title = $url['domain'] . $url['physical_uri'] . $url['virtual_uri'];
if (strlen($title) > 23) {
$title = substr($title, 0, 23) . '...';
}
$url['name'] = $title;
$shop['urls'][$url['id_shop_url']] = $url;
}
}
}
$shops_tree = new HelperTreeShops('shops-tree', 'Multistore tree');
$shops_tree->setNodeFolderTemplate('shop_tree_node_folder.tpl')->setNodeItemTemplate('shop_tree_node_item.tpl')->setHeaderTemplate('shop_tree_header.tpl')->setActions(array(new TreeToolbarLink('Collapse All', '#', '$(\'#' . $shops_tree->getId() . '\').tree(\'collapseAll\'); return false;', 'icon-collapse-alt'), new TreeToolbarLink('Expand All', '#', '$(\'#' . $shops_tree->getId() . '\').tree(\'expandAll\'); return false;', 'icon-expand-alt')))->setAttribute('url_shop_group', $this->context->link->getAdminLink('AdminShopGroup'))->setAttribute('url_shop', $this->context->link->getAdminLink('AdminShop'))->setAttribute('url_shop_url', $this->context->link->getAdminLink('AdminShopUrl'))->setData($data);
$shops_tree = $shops_tree->render(null, false, false);
if ($this->display == 'edit') {
$this->toolbar_title[] = $this->object->name;
}
$this->context->smarty->assign(array('toolbar_scroll' => 1, 'toolbar_btn' => $this->toolbar_btn, 'title' => $this->toolbar_title, 'shops_tree' => $shops_tree));
}
示例6: initContent
public function initContent()
{
if ($this->display == 'add') {
$this->display = 'list';
}
return parent::initContent();
}
示例7: initContent
public function initContent()
{
$array_carrier = array();
$carriers = Carrier::getCarriers($this->context->language->id, true, false, false, null, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE);
foreach ($carriers as $key => $carrier) {
if ($carrier['is_free']) {
unset($carriers[$key]);
} else {
$array_carrier[] = $carrier['id_carrier'];
}
}
$id_carrier = (int) Tools::getValue('id_carrier');
if (count($carriers) && isset($array_carrier[0])) {
if (!$id_carrier) {
$id_carrier = (int) $array_carrier[0];
}
$carrierSelected = new Carrier((int) $id_carrier);
} else {
$carrierSelected = new Carrier((int) $id_carrier);
}
$currency = $this->context->currency;
$rangeObj = $carrierSelected->getRangeObject();
$rangeTable = $carrierSelected->getRangeTable();
$suffix = $carrierSelected->getRangeSuffix();
$rangeIdentifier = 'id_' . $rangeTable;
$ranges = $rangeObj->getRanges($id_carrier);
$delivery = Carrier::getDeliveryPriceByRanges($rangeTable, $id_carrier);
$deliveryArray = array();
foreach ($delivery as $deliv) {
$deliveryArray[$deliv['id_zone']][$deliv['id_carrier']][$deliv[$rangeIdentifier]] = $deliv['price'];
}
$this->context->smarty->assign(array('zones' => $carrierSelected->getZones(), 'carriers' => $carriers, 'ranges' => $ranges, 'currency' => $currency, 'deliveryArray' => $deliveryArray, 'carrierSelected' => $carrierSelected, 'id_carrier' => $id_carrier, 'suffix' => $suffix, 'rangeIdentifier' => $rangeIdentifier, 'action_fees' => self::$currentIndex . '&token=' . $this->token));
parent::initContent();
}
示例8: initContent
public function initContent()
{
if ($this->display != 'add' && $this->display != 'edit') {
$this->checkForWarning();
}
parent::initContent();
}
示例9: initContent
public function initContent()
{
$this->display = 'options';
if (!$this->isGeoLiteCityAvailable()) {
$this->displayWarning($this->l('In order to use Geolocation, please download') . '
<a href="http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz">' . $this->l('this file') . '</a> ' . $this->l('and extract it (using Winrar or Gzip) into the /tools/geoip/ directory'));
}
parent::initContent();
}
示例10: initContent
public function initContent()
{
$this->display = 'options';
if (!$this->isGeoLiteCityAvailable()) {
$this->displayWarning($this->l('In order to use Geolocation, please download') . '
<a href="http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz" target="_blank">' . $this->l('this file') . '</a> ' . $this->l('and extract it (using Winrar or Gzip) into the /app/Resources/geoip/ directory.'));
Configuration::updateValue('PS_GEOLOCATION_ENABLED', 0);
}
parent::initContent();
}
示例11: initContent
public function initContent()
{
parent::initContent();
// INIT
$smarty = $this->context->smarty;
$smarty->assign('abc', 'lorem ipsum');
// TEMPLATE
// Ajouter le tpl dans /adminXXX/themes/default/template/controllers/eewee/eewee.tpl
$this->setTemplate('eewee.tpl');
}
示例12: initContent
public function initContent()
{
if ($this->action == 'select_delete') {
$this->context->smarty->assign(array('delete_form' => true, 'url_delete' => htmlentities($_SERVER['REQUEST_URI']), 'boxes' => $this->boxes));
}
if (!$this->can_add_customer && !$this->display) {
$this->informations[] = $this->l('You have to select a shop if you want to create a customer.');
}
parent::initContent();
}
示例13: initContent
public function initContent()
{
$parent_domain = Tools::getHttpHost(true) . substr($_SERVER['REQUEST_URI'], 0, -1 * strlen(basename($_SERVER['REQUEST_URI'])));
$iso_lang = $this->context->language->iso_code;
$iso_currency = $this->context->currency->iso_code;
$iso_country = $this->context->country->iso_code;
$addons_url = 'http://addons.prestashop.com/iframe/search-1.6.php?psVersion=' . _PS_VERSION_ . '&isoLang=' . $iso_lang . '&isoCurrency=' . $iso_currency . '&isoCountry=' . $iso_country . '&parentUrl=' . $parent_domain;
$addons_content = Tools::file_get_contents($addons_url);
$this->context->smarty->assign(array('iso_lang' => $iso_lang, 'iso_currency' => $iso_currency, 'iso_country' => $iso_country, 'display_addons_content' => $addons_content !== false, 'addons_content' => $addons_content, 'parent_domain' => $parent_domain));
parent::initContent();
}
示例14: initContent
public function initContent()
{
$this->list_simple_header = true;
parent::initContent();
if ($this->display == 'options') {
unset($this->toolbar_btn);
$this->toolbar_btn['new'] = array('desc' => $this->l('Add new shop group'), 'href' => self::$currentIndex . '&add' . $this->table . '&token=' . $this->token);
$this->toolbar_btn['new_2'] = array('desc' => $this->l('Add new shop'), 'href' => $this->context->link->getAdminLink('AdminShop') . '&addshop', 'imgclass' => 'new');
}
$this->addJqueryPlugin('cookie-plugin');
$this->addJqueryPlugin('jstree');
$this->addCSS(_PS_JS_DIR_ . 'jquery/plugins/jstree/themes/classic/style.css');
if ($this->display == 'edit') {
$this->toolbar_title[] = $this->object->name;
}
$this->context->smarty->assign(array('toolbar_scroll' => 1, 'toolbar_btn' => $this->toolbar_btn, 'title' => $this->toolbar_title, 'selected_tree_id' => $this->display == 'edit' ? 'tree-group-' . $this->id_object : 'tree-root'));
}
示例15: initContent
public function initContent()
{
$this->list_simple_header = true;
parent::initContent();
$this->addJqueryPlugin('cookie-plugin');
$this->addJqueryPlugin('jstree');
$this->addCSS(_PS_JS_DIR_ . 'jquery/plugins/jstree/themes/classic/style.css');
if ($this->display == 'edit') {
$this->toolbar_title[] = $this->object->name;
} else {
if (!$this->display && $this->id_shop_group) {
$group = new ShopGroup($this->id_shop_group);
$this->toolbar_title[] = $group->name;
}
}
$this->context->smarty->assign(array('toolbar_scroll' => 1, 'toolbar_btn' => $this->toolbar_btn, 'title' => $this->toolbar_title, 'selected_tree_id' => $this->display == 'edit' ? 'tree-shop-' . $this->id_object : (Tools::getValue('id_shop_group') ? 'tree-group-' . Tools::getValue('id_shop_group') : '')));
}