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


PHP HC_Lib类代码示例

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


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

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

示例2: title

 function title($model, $vlevel = HC_PRESENTER::VIEW_HTML)
 {
     $return = array();
     $label = $this->label($model, $vlevel);
     if (strlen($label)) {
         $return[] = $label;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_TEXT:
             $return[] = ': ';
             break;
     }
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML_ICON:
             break;
         default:
             if ($model->exists()) {
                 $return[] = $model->name;
             } else {
                 $return[] = HCM::__('Unknown');
             }
             break;
     }
     $return = join('', $return);
     switch ($vlevel) {
         case HC_PRESENTER::VIEW_HTML:
             $color = $model->present_color();
             $color = HC_Lib::adjust_color_brightness($color, -30);
             $return = HC_Html_Factory::element('span')->add_attr('class', 'label')->add_attr('class', 'label-success')->add_attr('class', 'label-lg')->add_child($return)->add_attr('style', 'background-color: ' . $color . ';');
             break;
     }
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:33,代码来源:location.php

示例3: todo

 function todo()
 {
     $conflict_ids = array();
     $t = HC_Lib::time();
     $today = $t->setNow()->formatDate_Db();
     /* find conflicts in upcoming shifts */
     $shifts = HC_App::model('shift');
     $shifts->where('date_end >=', $today)->where_related('user', 'id IS NOT ', 'NULL', FALSE);
     $shifts->get();
     $acl = HC_App::acl();
     $cmm = HC_App::model('conflict_manager');
     $count = 0;
     foreach ($shifts as $obj) {
         if (!$acl->set_object($obj)->can('conflicts::view')) {
             continue;
         }
         $entries = $cmm->get($obj, TRUE);
         if ($entries) {
             foreach ($entries as $e) {
                 $conflict_ids[$e->id] = 1;
             }
         }
     }
     if (!count($conflict_ids)) {
         return;
     }
     /* render view */
     $this->layout->set_partial('content', $this->render('conflicts/todo', array('count' => count($conflict_ids))));
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:30,代码来源:conflicts.php

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

示例5: __construct

 function __construct()
 {
     parent::__construct(USER_HC_MODEL::LEVEL_MANAGER);
     $this->forms = array();
     $this->forms['edit'] = HC_Lib::form()->set_input('first_name', 'text')->set_input('last_name', 'text')->set_input('email', 'text')->set_input('username', 'text')->set_input('level', 'select');
     $this->forms['password'] = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:7,代码来源:update.php

示例6: __construct

 function __construct($check_active = TRUE)
 {
     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 ($check_active) {
         $user = $this->auth->user();
         $user_active = 1;
         if ($user && $user->id) {
             $user_active = $user->active;
         }
         if (!$user_active) {
             $to = 'auth/notallowed';
             $this->redirect($to);
             exit;
         }
     }
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:26,代码来源:Front_controller.php

示例7: forgot_password

 function forgot_password()
 {
     $post = $this->input->post();
     $form = HC_Lib::form();
     $form->set_inputs(array('email' => 'text'));
     $validator = new HC_Validator();
     $validator->set_rules('email', 'required');
     if ($post && $validator->run($post) == TRUE) {
         $form->grab($post);
         $values = $form->values();
         $forgotten = $this->auth->forgotten_password($values['email']);
         if ($forgotten) {
             //if there were no errors
             $this->session->set_flashdata('message', HCM::__('Password reset message has been sent to your email'));
             $this->redirect('auth/login');
         } else {
             $this->session->set_flashdata('error', $this->auth->error);
             $this->redirect('auth/forgot_password');
         }
     }
     $errors = $validator->error();
     $form->set_values($post);
     $form->set_errors($errors);
     $this->layout->set_partial('content', $this->render('auth/forgot_password', array('form' => $form)));
     $this->layout();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:26,代码来源:auth.php

示例8: __construct

 function __construct($name = '')
 {
     if (!strlen($name)) {
         $name = 'nts_' . HC_Lib::generate_rand();
     }
     $this->set_name($name);
 }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:7,代码来源:basic.php

示例9: render

 function render()
 {
     $model = $this->model();
     $start_link = $this->start_link();
     if (!$start_link) {
         // $start_link = 'availability';
         $start_link = 'admin/users/zoom/index/id/' . $model->user_id . '/tab/availability/_pass';
     }
     $href = HC_Lib::link($start_link . '/zoom/index', array('id' => $model->id));
     $nolink = $this->nolink();
     $new_window = $this->new_window();
     $wide = $this->wide();
     $a_link = HC_Html_Factory::widget('titled', 'a')->add_attr('href', $href);
     if (!$new_window) {
         $a_link->add_attr('class', 'hc-flatmodal-loader');
     } else {
         $a_link->add_attr('target', '_blank');
         $a_link->add_attr('class', 'hc-parent-loader');
     }
     if ($wide === 'mini') {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title(HC_PRESENTER::VIEW_HTML_ICON));
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
     } elseif ($wide) {
         $out = HC_Html_Factory::widget('grid');
         if (!$nolink) {
             $present_title = clone $a_link;
             $present_title->add_child($model->present_title());
         } else {
             $present_title = $model->present_title();
         }
         if (!$nolink) {
             $present_date = clone $a_link;
             $present_date->add_child($model->present_date());
         } else {
             $present_date = $model->present_date();
         }
         $out->add_item($present_title, 6);
         $out->add_item($present_date, 6);
     } else {
         $out = HC_Html_Factory::element('div');
         if (!$nolink) {
             $title = clone $a_link;
             $title->add_child($model->present_title());
         } else {
             $title = $model->present_title(HC_PRESENTER::VIEW_HTML_ICON);
         }
         $out->add_child($title);
         $out->add_attr('class', array('text-smaller'))->add_attr('class', array('text-muted'));
     }
     $out->add_attr('class', 'hc-common-link-parent')->add_attr('class', 'hc-no-underline');
     return $out->render();
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:58,代码来源:availability_view.php

示例10: _content_password

 private function _content_password($model)
 {
     $form = HC_Lib::form()->set_input('password', 'password')->set_input('confirm_password', 'password');
     if ($ri = HC_Lib::ri()) {
         $form->set_readonly();
     }
     // $form->set_values( $model->to_array() );
     $form->set_errors($model->errors());
     return $this->render('admin/users/zoom/password', array('form' => $form, 'object' => $model));
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:10,代码来源:zoom.php

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

示例12: __construct

 function __construct()
 {
     parent::__construct();
     $this->form = HC_Lib::form();
     $wum = HC_App::model('wordpress_user');
     $wordpress_roles = $wum->wp_roles();
     foreach ($wordpress_roles as $role_value => $role_name) {
         $field_name = 'role_' . $role_value;
         $this->form->set_input($field_name, 'dropdown');
     }
     $this->form->set_input('append_role_name', 'checkbox');
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:12,代码来源:setup.php

示例13: render

    function render()
    {
        $name = $this->name();
        $value = $this->value();
        $id = 'nts-' . $name;
        $t = HC_Lib::time();
        $t->setNow();
        $t->setStartDay();
        if ($value) {
            $t->modify('+' . $value . ' seconds');
            // $value = $t->formatTime();
        }
        $out = HC_Html_Factory::widget('container');
        /* hidden field to store our value */
        $hidden = HC_Html_Factory::input('hidden')->set_name($name)->set_value($value)->set_id($id);
        $out->add_item($hidden);
        /* text field to display */
        $display_name = $name . '_display';
        $display_id = 'nts-' . $display_name;
        $text = HC_Html_Factory::input('text')->set_name($display_name)->set_id($display_id)->add_attr('size', 7);
        if (strlen($value)) {
            $display_value = $t->formatTime();
            $text->set_value($display_value);
        }
        $out->add_item($text);
        $time_format = $t->timeFormat();
        $script = HC_Html_Factory::element('script');
        $script->add_attr('language', 'JavaScript');
        $js_code = <<<EOT

jQuery("#{$display_id}").timepicker(
{
\t'appendTo' : '#nts',
\t'timeFormat' :'{$time_format}',
\t'step' : 5,
}
);

jQuery("#{$display_id}").on('change', function(){
\tvar dbTime = jQuery(this).timepicker('getSecondsFromMidnight');
\tjQuery('#{$id}').val( dbTime );
});

EOT;
        $script->add_child($js_code);
        $out->add_item($script);
        $return = $this->decorate($out->render());
        return $return;
    }
开发者ID:kumarkvk,项目名称:vz_emp_shiftsSchedule,代码行数:49,代码来源:timepicker.php

示例14: __construct

 function __construct()
 {
     parent::__construct(USER_HC_MODEL::LEVEL_ADMIN);
     $this->form = HC_Lib::form();
     $defaults = array();
     $app_conf = HC_App::app_conf();
     $wum = HC_App::model('wordpress_user');
     $wordpress_roles = $wum->wp_roles();
     foreach ($wordpress_roles as $role_value => $role_name) {
         $field_name = 'role_' . $role_value;
         $this->form->set_input($field_name, 'dropdown');
         $default = $app_conf->get('wordpress_' . $field_name);
         $defaults[$field_name] = $default;
     }
     $this->form->set_input('append_role_name', 'checkbox');
     $this->form->set_values($defaults);
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:17,代码来源:users.php

示例15: __construct

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


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