本文整理汇总了PHP中Profile::getProfileAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getProfileAccess方法的具体用法?PHP Profile::getProfileAccess怎么用?PHP Profile::getProfileAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::getProfileAccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id_category = intval(Tools::getValue('id_category'))) {
if (!Category::checkBeforeMove($id_category, intval(Tools::getValue('id_parent')))) {
$this->_errors[] = Tools::displayError('category cannot be moved here');
return false;
}
// Updating customer's group
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit anything here.');
} else {
$object = new $this->className($id_category);
if (Validate::isLoadedObject($object)) {
$object->updateGroup(Tools::getValue('groupBox'));
} else {
$this->_errors[] = Tools::displayError('an error occurred while updating object') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
}
}
}
parent::postProcess();
}
示例2: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors));
// send _errors as reference to allow postProcessAttributeGroup to stop saving process
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
if (isset($this->_errors) && count($this->_errors)) {
$key = array_search('An error occurred during deletion of ' . $this->table . '.', $this->_errors);
if ($key !== false) {
$this->_errors[$key] = Tools::displayError('cannot delete this Attribute Group, the selected item is still associated with one or more product combinations');
}
}
}
示例3: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
Module::hookExec('postProcessAttributeGroup', array('errors' => &$this->_errors));
// send _errors as reference to allow postProcessAttributeGroup to stop saving process
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
}
示例4: checkTabRights
function checkTabRights($id_tab)
{
global $cookie;
$tabAccess = Profile::getProfileAccess($cookie->profile, intval($id_tab));
if ($tabAccess['view'] === '1') {
return true;
}
return false;
}
示例5: initProcess
public function initProcess()
{
parent::initProcess();
$access = Profile::getProfileAccess($this->context->employee->id_profile, (int) Tab::getIdFromClassName('AdminOrders'));
if ($access['view'] === '1' && ($action = Tools::getValue('submitAction'))) {
$this->action = $action;
} else {
$this->errors[] = Tools::displayError('You do not have permission to view this.');
}
}
示例6: initProcess
public function initProcess()
{
parent::initProcess();
$this->checkCacheFolder();
$access = Profile::getProfileAccess($this->context->employee->id_profile, (int) Tab::getIdFromClassName('AdminOrders'));
if ($access['view'] === '1' && ($action = Tools::getValue('submitAction'))) {
$this->action = $action;
} else {
$this->errors[] = $this->trans('You do not have permission to view this.', array(), 'Admin.Notifications.Error');
}
}
示例7: __construct
public function __construct()
{
$this->display = 'view';
$this->table = 'carrier';
$this->identifier = 'id_carrier';
$this->className = 'Carrier';
$this->lang = false;
$this->deleted = true;
$this->step_number = 0;
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 's');
parent::__construct();
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, Tab::getIdFromClassName('AdminCarriers'));
}
示例8: postProcess
public function postProcess()
{
/* PrestaShop demo mode */
if (_PS_MODE_DEMO_) {
$this->_errors[] = Tools::displayError('This functionnality has been disabled.');
return;
}
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if ($this->tabAccess['add'] === '1' and Tools::isSubmit('submitAdd' . $this->table)) {
if ($id = (int) Tools::getValue('id_attachment') and $a = new Attachment($id)) {
$_POST['file'] = $a->file;
$_POST['mime'] = $a->mime;
}
if (!sizeof($this->_errors)) {
if (isset($_FILES['file']) and is_uploaded_file($_FILES['file']['tmp_name'])) {
if ($_FILES['file']['size'] > Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 * 1024) {
$this->_errors[] = $this->l('File too large, maximum size allowed:') . ' ' . Configuration::get('PS_ATTACHMENT_MAXIMUM_SIZE') * 1024 . ' ' . $this->l('kb') . '. ' . $this->l('File size you\'re trying to upload is:') . number_format($_FILES['file']['size'] / 1024, 2, '.', '') . $this->l('kb');
} else {
do {
$uniqid = sha1(microtime());
} while (file_exists(_PS_DOWNLOAD_DIR_ . $uniqid));
if (!copy($_FILES['file']['tmp_name'], _PS_DOWNLOAD_DIR_ . $uniqid)) {
$this->_errors[] = $this->l('File copy failed');
}
$_POST['file_name'] = $_FILES['file']['name'];
@unlink($_FILES['file']['tmp_name']);
if (!sizeof($this->_errors) && file_exists(_PS_DOWNLOAD_DIR_ . $a->file)) {
@unlink(_PS_DOWNLOAD_DIR_ . $a->file);
}
$_POST['file'] = $uniqid;
$_POST['mime'] = $_FILES['file']['type'];
}
} elseif (array_key_exists('file', $_FILES) && (int) $_FILES['file']['error'] === 1) {
$max_upload = (int) ini_get('upload_max_filesize');
$max_post = (int) ini_get('post_max_size');
$upload_mb = min($max_upload, $max_post);
$this->_errors[] = $this->l('the File') . ' <b>' . $_FILES['file']['name'] . '</b> ' . $this->l('exceeds the size allowed by the server. This limit is set to') . ' <b>' . $upload_mb . $this->l('Mb') . '</b>';
} elseif (!empty($_FILES['file']['tmp_name'])) {
$this->_errors[] = $this->l('The file does not exist or cannot be downloaded;check your server configuration regarding the maximum upload size.');
}
}
$this->validateRules();
}
$return = parent::postProcess();
if (!$return && isset($uniqid) && file_exists(_PS_DOWNLOAD_DIR_ . $uniqid)) {
@unlink(_PS_DOWNLOAD_DIR_ . $uniqid);
}
return $return;
}
示例9: hookBackOfficeHome
public function hookBackOfficeHome($params)
{
global $cookie;
$this->_postProcess();
$currency = Currency::getCurrency(intval(Configuration::get('PS_CURRENCY_DEFAULT')));
$results = $this->getResults();
$employee = new Employee(intval($cookie->id_employee));
$id_tab_stats = Tab::getIdFromClassName('AdminStats');
$access = Profile::getProfileAccess($employee->id_profile, $id_tab_stats);
if (!$access['view']) {
return '';
}
$this->_html = '
<fieldset style="width:520px;">
<legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->l('Statistics') . '</legend>
<div style="float:left;width:240px;text-align:center">
<div style="float:left;width:120px;text-align:center">
<center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square1.gif\')">
<br /><br />' . Tools::displayPrice($results['total_sales'], $currency) . '
</p></center>
<p>' . $this->l('of sales') . '</p>
<center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square3.gif\')">
<br /><br />' . intval($results['total_registrations']) . '
</p></center>
<p>' . ($results['total_registrations'] != 1 ? $this->l('registrations') : $this->l('registration')) . '</p>
</div>
<div style="float:left;width:120px;text-align:center">
<center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square2.gif\')">
<br /><br />' . intval($results['total_orders']) . '
</p></center>
<p>' . ($results['total_orders'] != 1 ? $this->l('orders placed') : $this->l('order placed')) . '</p>
<center><p style="font-weight:bold;height:80px;width:100px;text-align:center;background-image:url(\'' . __PS_BASE_URI__ . 'modules/statshome/square4.gif\')">
<br /><br />' . intval($results['total_viewed']) . '
</p></center>
<p>' . ($results['total_viewed'] != 1 ? $this->l('product pages viewed') : $this->l('product page viewed')) . '</p>
</div>
</div>
<div style="float:right;text-align:right;width:240px">';
include_once dirname(__FILE__) . '/../..' . $this->_adminPath . '/tabs/AdminStats.php';
$this->_html .= AdminStatsTab::displayCalendarStatic(array('Calendar' => $this->l('Calendar'), 'Day' => $this->l('Day'), 'Month' => $this->l('Month'), 'Year' => $this->l('Year')));
$this->_html .= '<div class="space"></div>
<p style=" font-weight: bold ">' . $this->l('Visitors online now:') . ' ' . intval($this->getVisitorsNow()) . '</p>
</div>
</fieldset>
<div class="clear space"><br /><br /></div>';
return $this->_html;
}
示例10: postProcess
public function postProcess()
{
global $cookie;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if ($this->tabAccess['add'] === '1' and Tools::isSubmit('submitAdd' . $this->table)) {
$this->deleted = false;
$_POST['invoice'] = Tools::getValue('invoice', 0);
$_POST['delivery'] = Tools::getValue('delivery', 0);
$_POST['logable'] = Tools::getValue('logable', 0);
$_POST['send_email'] = Tools::getValue('send_email', 0);
$_POST['hidden'] = Tools::getValue('hidden', 0);
if (!$_POST['send_email']) {
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
$_POST['template_' . (int) $language['id_lang']] = '';
}
}
parent::postProcess();
} elseif ($this->tabAccess['delete'] === '1' and isset($_GET['delete' . $this->table])) {
$orderState = new OrderState((int) $_GET['id_order_state'], $cookie->id_lang);
if (!$orderState->isRemovable()) {
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
} else {
parent::postProcess();
}
} elseif ($this->tabAccess['delete'] === '1' and isset($_POST['submitDelorder_state'])) {
foreach ($_POST[$this->table . 'Box'] as $selection) {
$orderState = new OrderState((int) $selection, $cookie->id_lang);
if (!$orderState->isRemovable()) {
$this->_errors[] = $this->l('For security reasons, you cannot delete default order statuses.');
break;
}
}
if (empty($this->_errors)) {
parent::postProcess();
}
} else {
parent::postProcess();
}
}
示例11: postProcess
public function postProcess()
{
global $cookie, $currentIndex;
$this->adminAttributes->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
$this->adminAttributes->postProcess($this->token);
if (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$object = new $this->className();
if ($object->deleteSelection($_POST[$this->table . 'Box'])) {
Tools::redirectAdmin($currentIndex . '&conf=2' . '&token=' . $this->token);
}
$this->_errors[] = Tools::displayError('an error occurred while deleting selection');
} else {
$this->_errors[] = Tools::displayError('you must select at least one element to delete');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} else {
parent::postProcess();
}
}
示例12: define
<?php
/*
* 2015-2016 DOGS
* @author J.Podracky, L.Fisher
* @copyright 2015-2016 F2FCREATIVE
*/
if (!defined('_PS_ADMIN_DIR_')) {
define('_PS_ADMIN_DIR_', getcwd());
}
include _PS_ADMIN_DIR_ . '/../config/config.inc.php';
if (!Context::getContext()->employee->isLoggedBack()) {
Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminLogin'));
}
$tabAccess = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminBackup'));
if ($tabAccess['view'] !== '1') {
die(Tools::displayError('You do not have permission to view this.'));
}
$backupdir = realpath(PrestaShopBackup::getBackupPath());
if ($backupdir === false) {
die(Tools::displayError('There is no "/backup" directory.'));
}
if (!($backupfile = Tools::getValue('filename'))) {
die(Tools::displayError('No file has been specified.'));
}
// Check the realpath so we can validate the backup file is under the backup directory
$backupfile = realpath($backupdir . DIRECTORY_SEPARATOR . $backupfile);
if ($backupfile === false or strncmp($backupdir, $backupfile, strlen($backupdir)) != 0) {
die(Tools::dieOrLog('The backup file does not exist.'));
}
if (substr($backupfile, -4) == '.bz2') {
示例13: content_566801a0a465f3_87307043
//.........这里部分代码省略.........
<i class="process-icon-<?php
if (isset($_smarty_tpl->tpl_vars['btn']->value['imgclass'])) {
echo $_smarty_tpl->tpl_vars['btn']->value['imgclass'];
} else {
echo $_smarty_tpl->tpl_vars['k']->value;
}
if (isset($_smarty_tpl->tpl_vars['btn']->value['class'])) {
?>
<?php
echo $_smarty_tpl->tpl_vars['btn']->value['class'];
}
?>
"></i>
</span>
</a>
<?php
}
?>
<?php
}
?>
<a class="list-toolbar-btn" href="javascript:location.reload();">
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="<?php
echo smartyTranslate(array('s' => 'Refresh list'), $_smarty_tpl);
?>
" data-html="true" data-placement="top">
<i class="process-icon-refresh"></i>
</span>
</a>
<?php
if (isset($_smarty_tpl->tpl_vars['sql']->value) && $_smarty_tpl->tpl_vars['sql']->value) {
?>
<?php
$_smarty_tpl->tpl_vars['sql_manager'] = new Smarty_variable(Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql')), null, 0);
?>
<?php
if ($_smarty_tpl->tpl_vars['sql_manager']->value['view'] == 1) {
?>
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true);
?>
').val() + '</div>'); $(this).attr('onclick', '');">
<span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php
echo smartyTranslate(array('s' => 'Show SQL query'), $_smarty_tpl);
?>
" data-html="true" data-placement="top" >
<i class="process-icon-terminal"></i>
</span>
</a>
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true);
?>
').val(createSqlQueryName()); $('#sql_query_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true);
?>
').val($('#sql_query_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true);
?>
').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['list_id']->value, ENT_QUOTES, 'UTF-8', true);
?>
').submit();">
<span class="label-tooltip" data-toggle="tooltip" data-original-title="<?php
echo smartyTranslate(array('s' => 'Export to SQL Manager'), $_smarty_tpl);
?>
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:67,代码来源:6e1aed7f56b4dda8639d53327488882919b52f9b.file.list_header.tpl.php
示例14: getModulesByInstallation
protected function getModulesByInstallation($tab_modules_list = null)
{
$all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
$all_unik_modules = array();
$modules_list = array('installed' => array(), 'not_installed' => array());
foreach ($all_modules as $mod) {
if (!isset($all_unik_modules[$mod->name])) {
$all_unik_modules[$mod->name] = $mod;
}
}
$all_modules = $all_unik_modules;
foreach ($all_modules as $module) {
if (!isset($tab_modules_list) || in_array($module->name, $tab_modules_list)) {
$perm = true;
if ($module->id) {
$perm &= Module::getPermissionStatic($module->id, 'configure');
} else {
$id_admin_module = Tab::getIdFromClassName('AdminModules');
$access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module);
if (!$access['edit']) {
$perm &= false;
}
}
if (in_array($module->name, $this->list_partners_modules)) {
$module->type = 'addonsPartner';
}
if ($perm) {
$this->fillModuleData($module, 'array');
if ($module->id) {
$modules_list['installed'][] = $module;
} else {
$modules_list['not_installed'][] = $module;
}
}
}
}
return $modules_list;
}
示例15: ajaxProcessGetTabModulesList
public function ajaxProcessGetTabModulesList()
{
$tab_modules_list = Tools::getValue('tab_modules_list');
$back = Tools::getValue('back_tab_modules_list');
if ($back) {
$back .= '&tab_modules_open=1';
}
$modules_list = array('installed' => array(), 'not_installed' => array());
if ($tab_modules_list) {
$tab_modules_list = explode(',', $tab_modules_list);
$all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
foreach ($all_modules as $module) {
if (in_array($module->name, $tab_modules_list)) {
$perm = true;
if ($module->id) {
$perm &= Module::getPermissionStatic($module->id, 'configure');
} else {
$id_admin_module = Tab::getIdFromClassName('AdminModules');
$access = Profile::getProfileAccess($this->context->employee->id_profile, $id_admin_module);
if (!$access['edit']) {
$perm &= false;
}
}
if ($perm) {
$this->fillModuleData($module, 'select', $back);
if ($module->id) {
$modules_list['installed'][] = $module;
} else {
$modules_list['not_installed'][] = $module;
}
}
}
}
}
$this->context->smarty->assign(array('tab_modules_list' => $modules_list, 'admin_module_favorites_view' => $this->context->link->getAdminLink('AdminModules') . '&select=favorites'));
$this->smartyOutputContent('controllers/modules/tab_modules_list.tpl');
exit;
}