当前位置: 首页>>代码示例>>PHP>>正文


PHP HC_App::acl方法代码示例

本文整理汇总了PHP中HC_App::acl方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_App::acl方法的具体用法?PHP HC_App::acl怎么用?PHP HC_App::acl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HC_App的用法示例。


在下文中一共展示了HC_App::acl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 function index($object, $object_id = NULL)
 {
     if (is_object($object)) {
         $object_class = $object->my_class();
         $object_id = $object->id;
     } else {
         $object_class = $object;
         $object = HC_App::model($object_class)->where('id', $object_id)->get();
     }
     /* load */
     $model = HC_App::model('logaudit');
     $acl = HC_App::acl();
     if (!$acl->set_object($object)->can('history::view')) {
         return;
     }
     $entries = $model->changes_by_time($object);
     $objects = array();
     foreach ($entries as $action_time => $obj_changes) {
         foreach (array_keys($obj_changes) as $object_full_id) {
             if (array_key_exists($object_full_id, $objects)) {
                 continue;
             }
             list($obj_class, $obj_id) = explode('.', $object_full_id);
             $child_object = HC_App::model($obj_class)->get_by_id($obj_id);
             if (!$acl->set_object($child_object)->can('view')) {
                 unset($entries[$action_time][$object_full_id]);
                 continue;
             }
             $objects[$object_full_id] = $child_object;
         }
     }
     /* render view */
     $this->layout->set_partial('content', $this->render('logaudit/index', array('object' => $object, 'objects' => $objects, 'entries' => $entries)));
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:35,代码来源:logaudit.php

示例2: index

 function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['id'])) {
         echo 'PARAMS MISSING IN availability/delete<br>';
         return;
     }
     $id = $args['id'];
     $model = HC_App::model('availability');
     $model->where('id', $id)->get();
     $this->_check_model($model);
     $acl = HC_App::acl();
     if (!$acl->set_object($model)->can('delete')) {
         return;
     }
     /* what to refresh on referring page */
     $parent_refresh = $model->present_calendar_refresh();
     $parent_refresh = array_keys($parent_refresh);
     if ($model->delete()) {
         $this->session->set_flashdata('message', HCM::__('Availability deleted'));
     } else {
         $this->session->set_flashdata('error', HCM::__('Error'));
     }
     $redirect_to = $this->my_parent();
     $this->redirect($redirect_to, $parent_refresh);
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:26,代码来源:delete.php

示例3: user_zoom_menubar

 function user_zoom_menubar($object)
 {
     $acl = HC_App::acl();
     if (!$acl->set_object($object)->can('loginlog::view')) {
         return;
     }
     return $this->render('loginlog/user_zoom_menubar', array('object' => $object));
 }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:8,代码来源:loginlog.php

示例4: index

 public function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['id'])) {
         echo 'PARAMS MISSING IN availability/update/index<br>';
         return;
     }
     $id = $args['id'];
     if (is_object($id)) {
         $model = $id;
     } else {
         $model = HC_App::model('availability');
         $model->where('id', $id)->get();
         $this->_check_model($model);
     }
     $acl = HC_App::acl();
     if (!$acl->set_object($model)->can('edit')) {
         return;
     }
     // $values = hc_parse_args( $args );
     $values = array();
     $form = $this->form_edit;
     $post = $this->input->post();
     if ($post) {
         $form->grab($post);
         $form_values = $form->values();
         $values = array_merge($values, $form_values);
     }
     $date_value = $form->input('date')->value(TRUE);
     if ($date_value['recurring'] == 'single') {
         $values['date_start'] = $date_value['datesingle'];
         $values['date_end'] = $date_value['datesingle'];
         $values['details'] = '';
     } else {
         $values['date_start'] = $date_value['datestart'];
         $values['date_end'] = $date_value['dateend'];
         $values['details'] = $form->input('date')->value(FALSE, TRUE);
     }
     unset($values['date']);
     $related = $model->from_array($values);
     // $action_result = $model->save( $related );
     $action_result = $model->save();
     if ($action_result) {
         $msg = HCM::__('Availability updated');
         $this->session->set_flashdata('message', $msg);
         $redirect_to = $this->my_parent();
         $redirect_to .= '/user/' . $model->user_id;
         /* what to refresh on referring page */
         $parent_refresh = $model->present_calendar_refresh();
         $parent_refresh = array_keys($parent_refresh);
         $this->redirect($redirect_to, $parent_refresh);
     } else {
         $form->set_errors($model->errors());
         $this->layout->set_partial('content', $this->render('availability/zoom/index', array('form' => $form, 'object' => $model)));
         $this->layout();
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:57,代码来源:update.php

示例5: filter_post

 function filter_post($shifts)
 {
     $return = array();
     $acl = HC_App::acl();
     foreach ($shifts as $sh) {
         if (!$acl->set_object($sh)->can('pickup')) {
             continue;
         }
         $return[] = $sh;
     }
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:12,代码来源:list.php

示例6: add_form_inputs

 function add_form_inputs($parent_object = NULL)
 {
     $acl = HC_App::acl();
     if ($parent_object) {
         if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
             return;
         }
     }
     $form = HC_Lib::form();
     $form->set_inputs(array('notifications_email_skip' => 'checkbox'));
     return $this->render('notifications_email/add_form_inputs', array('form' => $form));
 }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:12,代码来源:notifications_email.php

示例7: index

 function index($object)
 {
     if (!$this->_check_securuty($object)) {
         return;
     }
     $acl = HC_App::acl();
     if ($acl->set_object($object)->can('edit')) {
         $this->layout->set_partial('content', $this->render('release/index_edit', array('form' => $this->form_edit, 'object' => $object)));
     } else {
         $this->layout->set_partial('content', $this->render('release/index_view', array('object' => $object)));
     }
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:13,代码来源:zoom.php

示例8: __construct

 function __construct()
 {
     parent::__construct();
     // if we need to simulate user - in WP shortcut page */
     $app = HC_App::app();
     if (isset($GLOBALS['NTS_CONFIG'][$app]['SIMULATE_USER_ID'])) {
         $acl = HC_App::acl();
         $simulate_id = $GLOBALS['NTS_CONFIG'][$app]['SIMULATE_USER_ID'];
         $auth_user = $this->auth->user();
         $acl_user = $this->auth->user($simulate_id);
         if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
             $acl->set_user($acl_user);
         }
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:15,代码来源:MY_Controller.php

示例9: index

 public function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['user'])) {
         echo 'PARAMS MISSING IN availability/index<br>';
         return;
     }
     $user_id = is_object($args['user']) ? $args['user']->id : $args['user'];
     $model = HC_App::model('availability');
     $model->include_related('user', array('id', 'email', 'first_name', 'last_name', 'active'), TRUE, TRUE);
     $model->where_related('user', 'id', $user_id);
     $model->get();
     $user = HC_App::model('user')->where('id', $user_id)->get();
     $acl = HC_App::acl();
     $entries = $acl->filter($model, 'view');
     $this->layout->set_partial('content', $this->render('availability/index', array('entries' => $entries, 'user' => $user)));
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:18,代码来源:availability.php

示例10: _check_securuty

 protected function _check_securuty($object)
 {
     $return = FALSE;
     if ($object->status != $object->_const('STATUS_ACTIVE')) {
         return $return;
     }
     if ($object->type != $object->_const('TYPE_SHIFT')) {
         return $return;
     }
     if ($object->user_id) {
         return $return;
     }
     $acl = HC_App::acl();
     if (!$acl->set_object($object)->can('pickup')) {
         return $return;
     }
     $return = TRUE;
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:19,代码来源:zoom.php

示例11: open

 function open()
 {
     $t = HC_Lib::time();
     $today = $t->setNow()->formatDate_Db();
     $shifts = HC_App::model('shift');
     $shifts->where('date_end >=', $today)->where('status', $shifts->_const('STATUS_ACTIVE'))->where_related('user', 'id', NULL, TRUE);
     $shifts->get();
     $acl = HC_App::acl();
     $count = 0;
     foreach ($shifts as $obj) {
         if (!$acl->set_object($obj)->can('view')) {
             continue;
         }
         $count++;
     }
     /* view */
     $this->layout->set_partial('content', $this->render('admin/todo/open', array('count' => $count)));
     $this->layout();
 }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:19,代码来源:todo.php

示例12: deleterel

 function deleterel($id, $relname, $relid)
 {
     $model = HC_App::model('shift');
     $model->get_by_id($id);
     $this->_check_model($model);
     $acl = HC_App::acl();
     if (!$acl->set_object($model)->can($relname . '::delete')) {
         return;
     }
     $rel = $model->{$relname}->get_by_id($relid);
     if ($model->delete($rel, $relname)) {
         $this->session->set_flashdata('message', sprintf(HCM::_n('%d shift updated', '%d shifts updated', 1), 1));
     } else {
         $this->session->set_flashdata('error', HCM::__('Error'));
     }
     $redirect_to = 'shifts/zoom/' . $id;
     //			$redirect_to = '-referrer-';
     $this->redirect($redirect_to);
     return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:20,代码来源:delete.php

示例13: index

 public function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['id'])) {
         echo 'PARAMS MISSING IN availability/zoom/index<br>';
         return;
     }
     $id = $args['id'];
     if (is_object($id)) {
         $model = $id;
     } else {
         $model = HC_App::model('availability');
         $model->where('id', $id)->get();
         $this->_check_model($model);
     }
     $acl = HC_App::acl();
     if (!$acl->set_object($model)->can('view')) {
         return;
     }
     $form_values = $model->to_array();
     $date_input = clone $this->form_edit->input('date');
     $date_value = $date_input->unserialize($model->details, 'no-dates');
     $date_value['datestart'] = $model->date_start;
     $date_value['dateend'] = $model->date_end;
     $form_values['date'] = $date_value;
     $this->form_edit->set_values($form_values);
     /* HEADER */
     /*
     		$this->layout->set_partial(
     			'header_ajax',
     			$this->render(
     				$this->views_path . '/_header',
     				array(
     					'object'	=> $model,
     					)
     				)
     			);
     */
     $this->layout->set_partial('content', $this->render($this->views_path . '/index', array('form' => $this->form_edit, 'object' => $model)));
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:41,代码来源:zoom.php

示例14: insert

 function insert()
 {
     $args = func_get_args();
     $id = array_shift($args);
     $model = HC_App::model('shift');
     $model->where('id', $id)->get();
     $this->_check_model($model);
     $acl = HC_App::acl();
     if (!$acl->set_object($model)->can('release')) {
         return;
     }
     $current_user = $this->auth->user();
     $app_conf = HC_App::app_conf();
     $approval_required = $app_conf->get("release:approval_required");
     if ($approval_required) {
         $model->release_request = 1;
         $action_result = $model->save();
     } else {
         $action_result = $model->delete($current_user, 'user');
     }
     if ($action_result) {
         /* extensions */
         // $extensions->run('shifts/update', $post, $model);
         if ($approval_required) {
             $msg = HCM::__('Shift release request received');
         } else {
             $msg = HCM::__('Shift released');
         }
         /* save and redirect here */
         $this->session->set_flashdata('message', $msg);
     } else {
         /* save and redirect here */
         $this->session->set_flashdata('error', HCM::__('Error'));
     }
     $redirect_to = 'shifts/zoom/index/id/' . $id . '/tab/release';
     /* what to refresh on referring page */
     $parent_refresh = $model->present_calendar_refresh();
     $parent_refresh = array_keys($parent_refresh);
     $this->redirect($redirect_to, $parent_refresh);
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:40,代码来源:edit.php

示例15: add_form_inputs

 function add_form_inputs($parent_object = NULL)
 {
     $acl = HC_App::acl();
     if ($parent_object) {
         if (!$acl->set_object($parent_object)->can('notification_email::skip')) {
             return;
         }
     }
     $form = HC_Lib::form();
     $form->set_inputs(array('notifications_email_skip' => 'checkbox'));
     $default_values = array('notifications_email_skip' => 0);
     /* extensions */
     $extensions = HC_App::extensions();
     $change_values = $extensions->run('notifications_email/insert/defaults');
     foreach ($change_values as $change_array) {
         foreach ($change_array as $k => $v) {
             $default_values[$k] = $v;
         }
     }
     $form->set_values($default_values);
     return $this->render('notifications_email/add_form_inputs', array('form' => $form));
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:22,代码来源:notifications_email.php


注:本文中的HC_App::acl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。