本文整理汇总了PHP中HC_Lib类的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib类的具体用法?PHP HC_Lib怎么用?PHP HC_Lib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HC_Lib类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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
示例17: 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'];
$t = HC_Lib::time();
$t->setNow();
$date_start = $t->formatDate_Db();
$t->setEndMonth();
// $t->modify('+1 month');
$date_end = $t->formatDate_Db();
$form_values = array('user' => $user_id, 'date' => array('recurring' => 'single', 'datesingle' => $date_start, 'datestart' => $date_start, 'dateend' => $date_end, 'repeat' => 'daily'));
$this->form_add->set_values($form_values);
$this->layout->set_partial('content', $this->render('availability/add', array('form' => $this->form_add)));
$this->layout();
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:19,代码来源:add.php
示例18: get
function get($model)
{
$limit_qty = 2;
$limit_duration = 4 * 60 * 60;
$this->shift_id = $model->id;
$return = array();
/* find if the employee has more shifts that allowed per week */
if (!(strlen($model->start) && strlen($model->end))) {
return $return;
}
if (!($model->date && $model->date_end)) {
return $return;
}
if (!$model->user_id) {
return $return;
}
if ($model->type != $model->_const('TYPE_SHIFT')) {
return $return;
}
$t = HC_Lib::time();
$t->setDateDb($model->date);
list($start_week, $end_week) = $t->getDates('week', TRUE);
$my_qty = 0;
$my_duration = 0;
$sm = HC_App::model('shift');
$sm->select('id, date, date_end, start, end')->where_related('user', 'id', $model->user_id)->where('date_end >=', $start_week)->where('date <=', $end_week);
$sm->get_iterated_slim();
foreach ($sm as $test) {
$my_qty += 1;
$my_duration += $test->get_duration();
}
if ($my_qty > $limit_qty) {
$conflict = clone $this;
$conflict->details = 'qty:' . $my_qty;
$return[] = $conflict;
}
if ($my_duration > $limit_duration) {
$conflict = clone $this;
$conflict->details = 'duration:' . $my_duration;
$return[] = $conflict;
}
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:43,代码来源:conflict_week_limit.php
示例19: __construct
function __construct($name = '')
{
parent::__construct($name);
// $this->add_attr('class', 'timepicker');
$start_with = 0;
$end_with = 24 * 60 * 60;
/*
if( isset($more['conf']['min']) && ($more['conf']['min'] > $start_with) )
{
$start_with = $more['conf']['min'];
}
if( isset($more['conf']['max']) && ($more['conf']['max'] < $end_with) )
{
$end_with = $more['conf']['max'];
}
unset( $more['conf'] );
*/
if ($end_with < $start_with) {
$end_with = $start_with;
}
$step = 15 * 60;
$options = array();
$t = HC_Lib::time();
$t->setDateDb(20130118);
/*
if( $value && ($value > $end_with) )
{
$value = $value - 24 * 60 * 60;
}
*/
if ($start_with) {
$t->modify('+' . $start_with . ' seconds');
}
$no_of_steps = ($end_with - $start_with) / $step;
for ($ii = 0; $ii <= $no_of_steps; $ii++) {
$sec = $start_with + $ii * $step;
$options[$sec] = $t->formatTime();
$t->modify('+' . $step . ' seconds');
}
$this->set_options($options);
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:41,代码来源:time.php
示例20: render
function render()
{
$name = $this->name();
$value = $this->value();
$id = 'nts-' . $name;
$t = HC_Lib::time();
$value ? $t->setDateDb($value) : $t->setNow();
$value = $t->formatDate_Db();
$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;
$datepicker_format = $t->formatToDatepicker();
$display_value = $t->formatDate();
$text = HC_Html_Factory::input('text')->set_name($display_name)->set_value($display_value)->set_id($display_id)->add_attr('data-date-format', $datepicker_format)->add_attr('data-date-week-start', $t->weekStartsOn)->add_attr('style', 'width: 8em')->add_attr('class', 'hc-datepicker');
$out->add_item($text);
$return = $this->decorate($out->render());
return $return;
}
开发者ID:RCMmedia,项目名称:rubicon,代码行数:22,代码来源:date.php
注:本文中的HC_Lib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论