• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP HC_App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: label

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:27,代码来源:user.php


示例2: 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


示例3: 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


示例4: insert

 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();
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:31,代码来源:add.php


示例5: title

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:27,代码来源:conflict.php


示例6: _update

 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();
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:34,代码来源:update.php


示例7: created

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:29,代码来源:note.php


示例8: can

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:33,代码来源:acl.php


示例9: index

 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();
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:35,代码来源:insert.php


示例10: index

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:58,代码来源:dispatcher.php


示例11: 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


示例12: get

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:57,代码来源:conflict_availability_preferred.php


示例13: api_insert

 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;
 }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:10,代码来源:notifications_email.php


示例14: render

 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();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:11,代码来源:location.php


示例15: todo

 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();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:12,代码来源:release.php


示例16: 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


示例17: __construct

 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';
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:12,代码来源:list_toff.php


示例18: 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


示例19: api_insert

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:13,代码来源:notifications_email.php


示例20: save

 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;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:14,代码来源:user_preferences.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP HC_Html_Factory类代码示例发布时间:2022-05-23
下一篇:
PHP HCM类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap