示例#1
0
文件: user.php 项目: RCMmedia/rubicon
 function label($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = '';
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
         case HC_PRESENTER::VIEW_HTML_ICON:
             $ri = HC_Lib::ri();
             if ($ri == 'wordpress') {
                 $avatar = get_avatar($model->email, 16);
                 $return = HC_Html::icon('', TRUE, $avatar);
             } else {
                 $return = HC_Html::icon(HC_App::icon_for('user'));
                 if (!$model->exists()) {
                     $return->add_attr('class', 'text-danger');
                 } else {
                     if ($model->id && $model->active != $model->_const('STATUS_ACTIVE')) {
                         $return = HC_Html::icon_stack(array(HC_App::icon_for('user'), array('ban', 'text-muted')));
                     }
                 }
             }
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return = HCM::__('Staff');
             break;
     }
     return $return;
 }
示例#2
0
 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();
 }
示例#3
0
 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);
 }
示例#4
0
文件: add.php 项目: RCMmedia/rubicon
 function insert()
 {
     $model = HC_App::model('user');
     /* supplied as parameters */
     $args = func_get_args();
     $values = hc_parse_args($args);
     /* if post supplied */
     $post = $this->input->post();
     if ($post) {
         $this->forms['add']->grab($post);
         $post = $this->forms['add']->values();
         $values = array_merge($values, $post);
     }
     if (!$values) {
         $redirect_to = 'admin/users/add';
         $this->redirect($redirect_to);
         return;
     }
     $related = $model->from_array($values);
     if ($model->save($related)) {
         /* save and redirect here */
         $msg = HCM::__('User added');
         $this->session->set_flashdata('message', $msg);
         $redirect_to = 'admin/users/index';
         $this->redirect($redirect_to);
     } else {
         /* final layout */
         $this->layout->set_partial('content', Modules::run('admin/users/add/index', $model));
         $this->layout();
     }
 }
示例#5
0
 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
         case HC_PRESENTER::VIEW_HTML_ICON:
             $icon = HC_Html::icon(HC_App::icon_for('conflict'));
             $icon->add_attr('class', 'text-danger');
             $span = HC_Html_Factory::element('span')->add_attr('title', $model->present_title(HC_PRESENTER::VIEW_TEXT))->add_child($icon)->add_child($model->present_title(HC_PRESENTER::VIEW_TEXT));
             $return[] = $span;
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Conflict');
             $return[] = ': ';
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
         case HC_PRESENTER::VIEW_RAW:
             $return[] = $model->type;
             $return[] = ': ';
             $return[] = $model->details;
             break;
     }
     $return = join('', $return);
     return $return;
 }
示例#6
0
 private function _update($tab, $args)
 {
     $id = array_shift($args);
     $model = HC_App::model('user');
     $model->where('id', $id)->get();
     $this->_check_model($model);
     $original_model = clone $model;
     /* supplied as parameters */
     $values = hc_parse_args($args);
     /* if post supplied */
     $post = $this->input->post();
     if ($post) {
         $this->forms[$tab]->grab($post);
         $post = $this->forms[$tab]->values();
         $values = array_merge($values, $post);
     }
     if (!$values) {
         $redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab;
         $this->redirect($redirect_to);
         return;
     }
     $related = $model->from_array($values);
     if ($model->save($related)) {
         /* save and redirect here */
         $msg = HCM::__('User updated');
         $this->session->set_flashdata('message', $msg);
         $redirect_to = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab;
         $this->redirect($redirect_to);
     } else {
         /* final layout */
         $this->layout->set_partial('content', Modules::run('admin/users/zoom/index', 'id', $model, 'tab', $tab));
         $this->layout();
     }
 }
示例#7
0
文件: note.php 项目: RCMmedia/rubicon
 function created($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $value = $model->created;
     $t = HC_Lib::time();
     $t->setTimestamp($value);
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return[] = HC_Html::icon(HC_App::icon_for('date'));
             break;
     }
     $return[] = $t->formatDateFull();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return[] = HC_Html::icon(HC_App::icon_for('time'));
             break;
     }
     $return[] = $t->formatTime();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_TEXT:
         case HC_PRESENTER::VIEW_RAW:
             $return = join(' ', $return);
             break;
         default:
             $return = join('', $return);
             break;
     }
     return $return;
 }
示例#8
0
文件: acl.php 项目: RCMmedia/rubicon
 public function can($what, $params = array())
 {
     $return = FALSE;
     $object = $this->object();
     $user = $this->user();
     if (!$user) {
         $user = HC_App::model('user');
     }
     $check = array();
     if ($object) {
         $check[] = $object->my_class() . '::' . $object->id . '::' . $what;
         $check[] = $object->my_class() . '::' . '*' . '::' . $what;
         $check[] = $object->my_class() . '::' . $what;
         $check[] = $object->my_class() . '::' . '*';
     }
     $check[] = $what;
     $check[] = '*';
     reset($check);
     foreach ($check as $ch) {
         if (isset($this->rules[$ch])) {
             $rule = $this->rules[$ch];
             if (is_callable($rule)) {
                 $return = $rule($user, $object, $params);
             } else {
                 $return = $rule;
             }
             if ($return !== NULL) {
                 break;
             }
         }
     }
     return $return;
 }
示例#9
0
 public function index()
 {
     /* if post supplied */
     $post = $this->input->post();
     $values = array();
     if ($post) {
         $this->form_add->grab($post);
         $form_values = $this->form_add->values();
         $values = array_merge($values, $form_values);
     }
     $date_value = $this->form_add->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'] = $this->form_add->input('date')->value(FALSE, TRUE);
     }
     unset($values['date']);
     $model = HC_App::model('availability');
     $related = $model->from_array($values);
     $action_result = $model->save($related);
     if ($action_result) {
         $msg = HCM::__('Availability added');
         $this->session->set_flashdata('message', $msg);
         $redirect_to = $this->my_parent();
         $this->redirect($redirect_to);
     } else {
         $this->form_add->set_errors($model->errors());
         $this->layout->set_partial('content', $this->render('availability/add', array('form' => $this->form_add)));
         $this->layout();
     }
 }
示例#10
0
 public function index()
 {
     $app = $this->config->item('nts_app');
     $app_conf = HC_App::app_conf();
     if (isset($GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID'])) {
         $id = $GLOBALS['NTS_CONFIG'][$app]['FORCE_LOGIN_ID'];
         $this->auth->login($id);
     }
     // sync user account
     $ri = $this->remote_integration();
     if ($ri) {
         $id = $this->auth->check();
         if ($id) {
             $model_name = $ri . '_User';
             $um = HC_App::model($model_name);
             $um->sync($id);
             $this->auth->reset_user();
         }
     }
     // check user level
     $user_level = 0;
     $user_id = 0;
     if ($this->auth->check()) {
         if ($test_user = $this->auth->user()) {
             $user_id = $test_user->id;
             $user_level = $test_user->level;
         }
     }
     if ($ri) {
         $wall_schedule_display = 0;
     } else {
         $wall_schedule_display = $app_conf->get('wall:schedule_display');
     }
     $default_params = $this->default_params;
     $allowed = FALSE;
     switch ($user_level) {
         case 0:
             if ($wall_schedule_display <= $user_level) {
                 $to = 'list';
             } else {
                 if ($user_id) {
                     $to = 'auth/notallowed';
                 } else {
                     $to = 'auth/login';
                 }
             }
             break;
         case USER_HC_MODEL::LEVEL_ADMIN:
         case USER_HC_MODEL::LEVEL_MANAGER:
             $to = isset($default_params['route']) ? $default_params['route'] : 'list';
             break;
         case USER_HC_MODEL::LEVEL_STAFF:
             $to = isset($default_params['route']) ? $default_params['route'] : 'listme';
             break;
     }
     $this->redirect($to);
     exit;
 }
示例#11
0
 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();
     }
 }
 function get($model)
 {
     /* if the shift within the preferred availability */
     $myclass = get_class();
     $return = array();
     if ($model->type == $model->_const('TYPE_TIMEOFF')) {
         return $return;
     }
     if (!(strlen($model->start) && strlen($model->end))) {
         return $return;
     }
     if (!($model->date && $model->date_end)) {
         return $return;
     }
     if (!$model->user_id) {
         return $return;
     }
     $am = HC_App::model('availability');
     $am->where_related('user', 'id', $model->user_id)->where('type', $am->_const('TYPE_PREFERRED'))->where('date_end >=', $model->date)->where('date_start <=', $model->date_end);
     $am->get_iterated_slim();
     $found_availability = FALSE;
     foreach ($am as $availability) {
         /* get dates of this availability */
         $this_dates = $availability->get_dates();
         foreach ($this_dates as $this_date) {
             $test = HC_App::model('shift');
             $test->date = $this_date;
             $test->start = $availability->start;
             $test->end = $availability->end;
             $test->validate();
             if ($test->date_end < $model->date) {
                 continue;
             }
             if ($test->date > $model->date_end) {
                 break;
             }
             if ($test->covers($model)) {
                 $found_availability = TRUE;
                 break;
             }
         }
         if ($found_availability) {
             break;
         }
     }
     if (!$found_availability) {
         $conflict = new $myclass();
         $conflict_id = array($model->id);
         sort($conflict_id);
         $conflict_id = $this->type . '_' . join('_', $conflict_id);
         $conflict->id = $conflict_id;
         $conflict->shift_id = $model->id;
         // $conflict->details = $availability->id;
         $return[] = $conflict;
     }
     return $return;
 }
 function api_insert($post)
 {
     $notifications_email_skip = isset($post['notifications_email_skip']) ? $post['notifications_email_skip'] : FALSE;
     if ($notifications_email_skip) {
         $messages = HC_App::model('messages');
         $messages->remove_engine('email');
     }
     $return = TRUE;
     return $return;
 }
示例#14
0
 function render()
 {
     $model = HC_App::model('location');
     $model->get();
     $options = array();
     foreach ($model as $obj) {
         $options[$obj->id] = $obj->present_title();
     }
     $this->set_options($options);
     return parent::render();
 }
示例#15
0
 function todo()
 {
     $shifts = HC_App::model('shift')->where('release_request', 1);
     $shifts->get();
     $count = $shifts->result_count();
     if (!$count) {
         return;
     }
     /* render view */
     $this->layout->set_partial('content', $this->render('release/todo', array('count' => $count)));
     $this->layout();
 }
示例#16
0
文件: list.php 项目: RCMmedia/rubicon
 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;
 }
示例#17
0
 function __construct()
 {
     parent::__construct();
     $this->rootlink = 'list_toff';
     $temp_shift = HC_App::model('shift');
     // $this->fix['staff'] = array( $this->auth->user()->id );
     // $this->fix['location'] = array( 0 );
     // $this->fix['filter'] = NULL;
     $this->fix['type'] = array($temp_shift->_const('TYPE_TIMEOFF'));
     $this->fix['tab'] = 'browse';
     $this->default_params['range'] = 'upcoming';
 }
示例#18
0
文件: zoom.php 项目: RCMmedia/rubicon
 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();
 }
示例#19
0
 function api_insert($post)
 {
     $extensions = HC_App::extensions();
     $notifications_email_skip = isset($post['notifications_email_skip']) ? $post['notifications_email_skip'] : FALSE;
     if ($notifications_email_skip) {
         $messages = HC_App::model('messages');
         $messages->remove_engine('email');
     }
     /* extensions */
     $extensions->run('notifications_email/insert', $post);
     $return = TRUE;
     return $return;
 }
示例#20
0
 function save($prefix, $watch, $post)
 {
     $model = HC_App::model('user_preferences');
     foreach ($watch as $k) {
         $key = strlen($prefix) ? $prefix . '/' . $k : $k;
         $value = NULL;
         if (array_key_exists($k, $post)) {
             $value = $post[$k];
         }
         $model->set($key, $value);
     }
     $return = TRUE;
     return $return;
 }
示例#21
0
 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);
         }
     }
 }
 function details($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $conflicting_one = HC_App::model('availability');
     $conflicting_one->where('id', $model->details)->get();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return = HC_Html_Factory::widget('availability_view')->set_new_window(TRUE)->set_wide(TRUE);
             $return->set_model($conflicting_one);
             break;
         case HC_PRESENTER::VIEW_TEXT:
         case HC_PRESENTER::VIEW_RAW:
             $return = $conflicting_one->present_details($vlevel);
             break;
     }
     return $return;
 }
示例#23
0
文件: user.php 项目: RCMmedia/rubicon
 public function get_staff()
 {
     $app_conf = HC_App::app_conf();
     $working_levels = $app_conf->get('working_levels');
     $this->clear();
     /* get those users who can be assigned to shifts */
     $this->where('active', self::STATUS_ACTIVE);
     if ($working_levels) {
         if (!is_array($working_levels)) {
             $working_levels = array($working_levels);
         }
         $this->where_in('level', $working_levels);
     }
     $this->get();
     return $this;
 }
示例#24
0
 function __construct($user_level = 0)
 {
     parent::__construct();
     $this->load->library('migration');
     if (!$this->migration->current()) {
         //			show_error($this->migration->error_string());
         return false;
     }
     $nts_config = HC_Lib::nts_config();
     if (isset($nts_config['FORCE_LOGIN_ID'])) {
         $id = $nts_config['FORCE_LOGIN_ID'];
         $this->auth->login($id);
     }
     if (!$this->auth->check()) {
         $this->redirect('auth/login');
         exit;
     }
     /* check user active */
     $user_active = 0;
     if ($test_user = $this->auth->user()) {
         $user_active = $test_user->active;
     }
     if (!$user_active) {
         $to = 'auth/notallowed';
         $this->redirect($to);
         exit;
     }
     /* check user level */
     if ($user_level) {
         $this->check_level($user_level);
     }
     /* check license code */
     if ($this->hc_modules->exists('license')) {
         $license_model = HC_App::model('hitcode_license');
         $code = $license_model->get();
         if (!$code) {
             $to = 'license/admin';
             $current_slug = $this->get_current_slug();
             if ($current_slug != $to) {
                 $this->session->set_flashdata('error', 'license_code_required');
                 $this->redirect($to);
                 exit;
             }
         }
     }
 }
示例#25
0
 function delete($id)
 {
     $model = HC_App::model('user');
     $model->where('id', $id)->get();
     $this->_check_model($model);
     if ($model->delete()) {
         $msg = 'User deleted';
         $this->session->set_flashdata('message', $msg);
     } else {
         $errors = $model->errors();
         $msg = HCM::__('Error') . ': ' . join(' ', $errors);
         $this->session->set_flashdata('error', $msg);
     }
     $redirect_to = 'admin/users';
     $this->redirect($redirect_to);
     return;
 }
示例#26
0
文件: zoom.php 项目: RCMmedia/rubicon
 function index()
 {
     $args = hc_parse_args(func_get_args(), TRUE);
     if (!isset($args['id'])) {
         echo 'PARAMS MISSING IN admin/users/zoom/index<br>';
         return;
     }
     /* PARAMS */
     $id = $args['id'];
     $tab = isset($args['tab']) ? $args['tab'] : 'edit';
     $subtab = isset($args['subtab']) ? $args['subtab'] : '';
     if (is_object($id)) {
         $model = $id;
     } else {
         $model = HC_App::model('user');
         $model->where('id', $id)->get();
         $this->_check_model($model);
     }
     /* build content */
     $subheader = NULL;
     $content = '';
     $method = '_content_' . $tab;
     if (method_exists($this, $method)) {
         $content = $this->{$method}($model);
     } else {
         $extensions = HC_App::extensions();
         if ($extensions->has(array('admin/users/zoom', $tab))) {
             $calling_parent = 'admin/users/zoom/index/id/' . $id . '/tab/' . $tab;
             $pass_arg = isset($args['_pass']) ? $args['_pass'] : array();
             array_unshift($pass_arg, array('admin/users/zoom', $tab, $calling_parent));
             $pass_arg[] = 'user';
             $pass_arg[] = $model->id;
             $content = call_user_func_array(array($extensions, 'run'), $pass_arg);
             $subheader = $extensions->run(array('admin/users/zoom/menubar', $tab), $model);
         }
     }
     /* CONTENT */
     $content = $this->render($this->views_path . '/index', array('subheader' => $subheader, 'content' => $content));
     $this->layout->set_partial('content', $content);
     /* HEADER */
     $this->layout->set_partial('header_ajax', $this->render($this->views_path . '/_header', array('object' => $model)));
     /* MENUBAR */
     $this->layout->set_partial('sidebar', $this->render($this->views_path . '/_menubar', array('tab' => $tab, 'object' => $model)));
     $this->layout();
 }
示例#27
0
 private function _time($value, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $return[] = HC_Html::icon(HC_App::icon_for('time'));
             break;
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = HCM::__('Time');
             $return[] = ': ';
             break;
     }
     $t = HC_Lib::time();
     $t->setTimestamp($value);
     $return[] = $t->formatTime();
     $return = join('', $return);
     return $return;
 }
示例#28
0
 public function attempt($identity, $password, $remember = FALSE)
 {
     $app_conf = HC_App::app_conf();
     $login_with = $app_conf->get('login_with');
     if ($login_with != 'username') {
         $identity_name = 'email';
     } else {
         $identity_name = 'username';
     }
     $where = array($identity_name => $identity);
     $this->auth_model->from_array($where);
     if ($this->auth_model->check_password($password)) {
         $this->login($this->auth_model->id);
         return TRUE;
     } else {
         return FALSE;
     }
 }
示例#29
0
文件: form.php 项目: RCMmedia/rubicon
 function render()
 {
     list($csrf_name, $csrf_value) = HC_App::csrf();
     $out = HC_Html_Factory::element('form')->add_attr('method', $this->method())->add_attr('accept-charset', 'utf-8')->add_attr('id', $this->id());
     $attr = $this->attr();
     foreach ($attr as $k => $v) {
         $out->add_attr($k, $v);
     }
     /* add csrf */
     if ($this->method() != 'get') {
         if (strlen($csrf_name) && strlen($csrf_value)) {
             $hidden = HC_Html_Factory::input('hidden', $csrf_name)->set_value($csrf_value);
             $out->add_child(HC_Html_Factory::element('div')->add_attr('style', 'display:none')->add_child($hidden));
         }
     }
     $out->add_child(parent::render());
     return $out->render();
 }
示例#30
0
 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();
 }