本文整理汇总了PHP中role::check方法的典型用法代码示例。如果您正苦于以下问题:PHP role::check方法的具体用法?PHP role::check怎么用?PHP role::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类role
的用法示例。
在下文中一共展示了role::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* 添加
*/
public function add()
{
$this->site_ids = role::check('role_edit');
if ($_POST) {
//标签过滤
tool::filter_strip_tags($_POST);
$name = $this->input->post('name');
$role = Myrole::instance()->get_by_name($name);
$parent_id = $this->input->post('parent_id');
if ($role['id']) {
remind::set(Kohana::lang('o_manage.group_has_exist'), 'manage/role/add');
}
if ($parent_id > 0) {
$role = Myrole::instance($parent_id)->get();
//zhu add
if ($role['type'] != $this->input->post('type')) {
remind::set(Kohana::lang('o_manage.parent_group_type_not_match'), 'manage/role/add');
}
$_POST['level_depth'] = $role['level_depth'] + 1;
} else {
$_POST['level_depth'] = 1;
}
if (Myrole::instance()->add($_POST)) {
remind::set(Kohana::lang('o_global.add_success'), 'manage/role', 'success');
} else {
remind::set(Kohana::lang('o_global.add_error'), 'manage/role/add');
}
}
$roles = Myrole::instance()->roles();
$this->template->content = new View("manage/role_add");
$this->template->content->roles = $roles;
}
示例2: index
public function index()
{
role::check('user_charge_orders');
/* 初始化默认查询条件 */
$user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => "DESC"), 'limit' => array('per_page' => 20, 'offset' => 0));
/* 用户列表模板 */
$this->template->content = new View("user/user_charge_orders");
/* 搜索功能 */
$search_arr = array('order_num');
$search_value = $this->input->get('search_value');
$where_view = array();
$user_query_struct['like']['order_num'] = $search_value;
//$user_query_struct['like']['ret_order_num'] = $search_value;
$where_view['search_value'] = $search_value;
/* 每页显示条数 */
$per_page = controller_tool::per_page();
$user_query_struct['limit']['per_page'] = $per_page;
/* 调用分页 */
$this->pagination = new Pagination(array('total_items' => User_chargeService::get_instance()->query_count($user_query_struct), 'items_per_page' => $per_page));
//d($this->pagination->sql_offset);
$user_query_struct['limit']['offset'] = $this->pagination->sql_offset;
$users = User_chargeService::get_instance()->lists($user_query_struct);
$userobj = user::get_instance();
foreach ($users as $key => $rowuser) {
$users[$key]['userinfo'] = $userobj->get($rowuser['user_id']);
}
/* 调用列表 */
$this->template->content->user_list = $users;
$this->template->content->where = $where_view;
$this->template->content->pay_banks = Kohana::config('pay_banks');
}
示例3: do_active
/**
* 改变状态
*/
function do_active($id)
{
//权限验证
role::check('user_charge');
if (!$id) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
}
$db = Database::instance();
$data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false));
if ($data['id'] <= 0 || $data['status'] > 0) {
remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge');
}
$logodata = array();
$logodata['manager_id'] = $this->manager_id;
$logodata['ip'] = tool::get_str_ip();
$logodata['user_log_type'] = 27;
$logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()';
$logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money'];
$sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' ";
if ($db->query($sql)) {
//充值用户Money
$sql_reward = "UPDATE users \r\n SET user_money = user_money+" . $data['price'] . "\r\n WHERE id='" . $data['user_id'] . "'\r\n ";
$db->query($sql_reward);
//操作log
ulog::add($logodata);
remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success');
} else {
//操作log
ulog::add($logodata, 1);
remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error');
}
}
示例4: __construct
public function __construct()
{
role::check('site_seo');
parent::__construct();
if ($this->is_ajax_request() == TRUE) {
$this->template = new View('layout/default_json');
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
if ($this->is_ajax_request()) {
$this->template = new View('layout/default_json');
}
role::check('order_edit');
}
示例6: __construct
public function __construct()
{
parent::__construct();
if ($this->is_ajax_request() == TRUE) {
$this->template = new View('layout/default_json');
}
role::check('orders');
$this->order_basic_obj = OrderBasic::instance();
$this->order_detail_obj = OrderDetail::instance();
}
示例7: __construct
public function __construct()
{
role::check('product_inquiry');
$this->package_name = 'product';
$this->class_name = strtolower(substr(__CLASS__, 0, strpos(__CLASS__, '_')));
parent::__construct();
if ($this->is_ajax_request()) {
$this->template = new View('layout/default_json');
}
}
示例8: batch_delete
/**
* 批量删除支付方式
*/
public function batch_delete()
{
//初始化返回数据
$return_data = array();
//请求结构体
$request_data = array();
/* 可管理的站点ID列表 */
role::check('manage_payment_type');
try {
$payment_type_ids = $this->input->post('payment_type_id');
if (is_array($payment_type_ids) && count($payment_type_ids) > 0) {
/* 初始化默认查询条件 */
$query_struct = array('where' => array('id' => $payment_type_ids), 'like' => array(), 'limit' => array('per_page' => 300, 'offset' => 0));
$payment_types = Mypayment_type::instance()->query_assoc($query_struct);
/* 删除失败的 */
$failed_payment_type_names = '';
/* 执行操作 */
foreach ($payment_types as $key => $payment_type) {
if (!Mypayment_type::instance($payment_type['id'])->delete()) {
$failed_payment_type_names .= ' | ' . $payment_type['name'];
}
}
if (empty($failed_payment_type_names)) {
throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_success'), 403);
} else {
/* 中转提示页面的停留时间 */
$return_struct['action']['time'] = 10;
$failed_payment_type_names = trim($failed_payment_type_names, ' | ');
throw new MyRuntimeException(Kohana::lang('o_manage.delete_payment_type_error', $failed_payment_type_names), 403);
}
} else {
throw new MyRuntimeException(Kohana::lang('o_global.data_load_error'), 403);
}
} catch (MyRuntimeException $ex) {
$return_struct['status'] = 0;
$return_struct['code'] = $ex->getCode();
$return_struct['msg'] = $ex->getMessage();
//TODO 异常处理
//throw $ex;
if ($this->is_ajax_request()) {
$this->template = new View('layout/empty_html');
$this->template->content = $return_struct['msg'];
} else {
$this->template->return_struct = $return_struct;
$content = new View('info');
$this->template->content = $content;
/* 请求结构数据绑定 */
$this->template->content->request_data = $request_data;
/* 返回结构体绑定 */
$this->template->content->return_struct = $return_struct;
}
}
}
示例9: index
public function index()
{
role::check('card_system_manage');
$per_page = controller_tool::per_page();
$orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('order' => 'ASC'), 3 => array('order' => 'DESC'));
$orderby = controller_tool::orderby($orderby_arr);
$query_struct = array('where' => array(), 'orderby' => $orderby, 'limit' => array('per_page' => $per_page, 'offset' => 0));
$total = $this->cardLogDao->count_items_with_condition($query_struct['where']);
$this->pagination = new Pagination(array('base_url' => url::current(), 'uri_segment' => 'page', 'total_items' => $total, 'items_per_page' => $per_page, 'style' => 'digg'));
$query_struct['limit']['offset'] = $this->pagination->sql_offset;
$cardLogList = $this->cardLogDao->lists($query_struct);
$this->template->content = new View("card/card_log_list");
$this->template->content->data = $cardLogList;
}
示例10: index
public function index()
{
/* 初始化默认查询条件 */
$newsletter_query_struct = array('where' => array('user_id' => 0), 'like' => array(), 'orderby' => array(), 'limit' => array('per_page' => 20, 'offset' => 0));
/* 权限检查 得到所有可管理站点ID列表 */
$site_id_list = role::check('newsletter');
/* Newsletter列表模板 */
$this->template->content = new View("user/newsletter");
/* 搜索功能 */
$search_arr = array('email', 'ip');
$search_value = $this->input->get('search_value');
$search_type = $this->input->get('search_type');
$where_view = array();
if ($search_arr) {
foreach ($search_arr as $value) {
if ($search_type == $value && strlen($search_value) > 0) {
$newsletter_query_struct['where'][$value] = $search_value;
if ($value == 'ip') {
$newsletter_query_struct['where'][$value] = tool::myip2long($search_value);
}
}
}
$where_view['search_type'] = $search_type;
$where_view['search_value'] = $search_value;
}
//当前切入的站点查询条件
$site_in = site::current_query_site_ids();
$where_view['site_id'] = '';
$newsletter_query_struct['where']['site_id'] = $site_in;
/* 列表排序 */
$orderby_arr = array(0 => array('id' => 'DESC'), 1 => array('id' => 'ASC'), 2 => array('site_id' => 'ASC'), 3 => array('site_id' => 'DESC'), 4 => array('email' => 'ASC'), 5 => array('email' => 'DESC'), 6 => array('date_add' => 'ASC'), 7 => array('date_add' => 'DESC'), 8 => array('ip' => 'ASC'), 9 => array('ip' => 'DESC'), 10 => array('active' => 'ASC'), 11 => array('active' => 'DESC'));
$orderby = controller_tool::orderby($orderby_arr);
$newsletter_query_struct['orderby'] = $orderby;
/* 每页显示条数 */
$per_page = controller_tool::per_page();
$newsletter_query_struct['limit']['per_page'] = $per_page;
/* 调用分页 */
$this->pagination = new Pagination(array('total_items' => Mynewsletter::instance()->query_count($newsletter_query_struct), 'items_per_page' => $per_page));
$newsletter_query_struct['limit']['offset'] = $this->pagination->sql_offset;
$newsletters = Mynewsletter::instance()->query_assoc($newsletter_query_struct);
foreach ($newsletters as $key => $value) {
$site = Mysite::instance($value['site_id'])->get();
$newsletters[$key]['site'] = $site;
}
/* 调用列表 */
$this->template->content->newsletter_list = $newsletters;
/* 搜索信息保存 */
$this->template->content->where = $where_view;
}
示例11: delete
public function delete($templateId)
{
//权限检查 得到所有可管理站点ID列表
role::check('distribution_system_manage');
$templateDao = Superplaner_Realtime_contract_template::instance();
$template = $templateDao->get_by_id($templateId);
if ($template == null) {
remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error');
}
if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) {
remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success');
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
}
}
示例12: open_bill_detail
public function open_bill_detail($openBillId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
if ($openBillId == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
$openBill = $this->issueBillDao->get_by_id($openBillId);
if ($openBill == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
$this->template->content = new View("card/open_bill_detail");
$this->template->content->openBill = $openBill;
$this->template->content->channelList = $this->salesChannelMap;
}
示例13: delete
public function delete($cardTypeId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
$cardType = $this->cardTypeDao->get_by_id($cardTypeId);
if ($cardType == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
if ($this->cardTypeDao->delete($cardTypeId)) {
remind::set(Kohana::lang('o_global.delete_success'), 'card/card_type', 'success');
return;
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
return;
}
}
示例14: desktop
function desktop()
{
//权限验证
role::check('default');
//各个时间段的订单数量
$stat_date = Myorder::instance()->stat_by_date();
//已支付订单数量
// 初始化默认查询条件
$order_query_struct = array('where' => array('active' => 1), 'like' => array(), 'orderby' => array('order' => 'ASC'), 'limit' => array('per_page' => 20, 'offset' => 0));
/* 已支付未做处理的订单 */
$order_query_struct['where']['pay_status'] = 3;
$order_query_struct['where']['order_status'] = 1;
$order_query_struct['where']['ship_status'] = 1;
$count_pay = Myorder::instance()->query_count($order_query_struct);
//有订单用户数量
$count_order_user = Myorder::instance()->count_order_user();
/* 初始化默认查询条件 */
$user_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array(), 'limit' => array());
//用户总数
$count_user = Myuser::instance()->query_count();
//今日用户
$today = date('Y-m-d H:i:s', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$user_query_struct['where']['date_add >='] = $today;
$count_today_user = Myuser::instance()->query_count($user_query_struct);
//有留言的订单数量
$count_order_message = Myorder_message::instance()->count_order();
//新的网站留言
$count_contact_us = Mycontact_us::instance()->count(array('active' => '1'));
/* 平台公告列表 */
$notice_query_struct = array('where' => array(), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 3, 'offset' => 0));
$notices = Mynotice::instance()->query_assoc($notice_query_struct);
$this->template->content = new View("index_desktop");
$this->template->content->count_pay = $count_pay;
$this->template->content->count_order_message = $count_order_message;
$this->template->content->count_contact_us = $count_contact_us;
$this->template->content->count_order_user = $count_order_user;
$this->template->content->count_user = $count_user;
$this->template->content->count_today_user = $count_today_user;
$this->template->content->notices = $notices;
$this->template->content->stat_date = $stat_date;
}
示例15: delete
public function delete($moneyExchangeId)
{
//权限检查 得到所有可管理站点ID列表
role::check('card_system_manage');
$moneyExchange = $this->moneyExchangeDao->get_by_id($moneyExchangeId);
if ($moneyExchange == null) {
remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error');
return;
}
if ($moneyExchange['flag'] == 2) {
remind::set("不能删除生效中的汇率方案", request::referrer(), 'error');
return;
}
if ($this->moneyExchangeDao->delete($moneyExchange)) {
remind::set(Kohana::lang('o_global.delete_success'), 'card/money_exchange', 'success');
return;
} else {
remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error');
return;
}
}