本文整理汇总了PHP中HC_Lib::link方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::link方法的具体用法?PHP HC_Lib::link怎么用?PHP HC_Lib::link使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::link方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: array
<?php
if (!$count) {
return;
}
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list/index', array('filter' => 'conflicts'));
$title = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item('title', HC_Html_Factory::widget('titled', 'a')->add_attr('href', $linkto)->add_child(HCM::__('Conflicts')))->add_item('count', HC_Html_Factory::element('span')->add_attr('class', 'badge')->add_child($count));
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-danger')->add_child($title);
echo $out->render();
示例3: array
break;
}
if ($sh->date < $this_date) {
continue;
}
$this_shifts[] = $sh;
}
$date_content = NULL;
$this_state['date'] = $this_date;
$date_content = HC_Html_Factory::widget('module')->set_url($rootlink . '/day')->pass_arg(array($this_shifts, $this_state))->set_param('date', $this_date)->set_param('location', $entity_id)->set_param('wide', 'mini')->add_attr('class', 'hc-rfr-' . 'dat-' . $this_date . '-loc-' . $entity_id);
$cell_key = $entity_id . '_' . $this_date;
$CELLS[$cell_key] = $date_content;
/* links */
$LINKS[$cell_key] = NULL;
if ($can_add) {
$btns = HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('shifts/add/index')->url(array('date' => $this_date, 'location' => $entity_id, 'type' => $test_shift->_const('TYPE_SHIFT'))))->add_attr('class', 'hc-flatmodal-loader')->add_attr('class', 'btn')->add_attr('class', 'btn-xs')->add_attr('class', 'btn-archive')->add_attr('class', 'display-block')->add_attr('style', 'text-align: center;')->add_child(HC_Html::icon('plus'))->add_attr('title', HCM::__('Add'));
$LINKS[$cell_key] = $btns;
}
}
}
/* now display */
$out = HC_Html_Factory::widget('table')->set_engine('div');
/* dates row */
$rid = 0;
$cid = 0;
$out->set_cell($rid, $cid, '');
$out->add_cell_attr($rid, $cid, array('class' => array('cal-cell-title')));
$cid++;
reset($dates);
foreach ($dates as $date) {
$out->set_cell($rid, $cid, $DATE_LABELS[$date]);
示例4: array
<?php
if (!$count) {
return;
}
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list/index', array('filter' => 'draft'));
$title = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item('title', HC_Html_Factory::widget('titled', 'a')->add_attr('href', $linkto)->add_child(HCM::__('Draft Shifts')))->add_item('count', HC_Html_Factory::element('span')->add_attr('class', 'badge')->add_child($count));
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-default-o')->add_child($title);
//$color = Hc_lib::random_html_color( 2 );
$color = '#dff0d8';
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
$out->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t-45deg,\r\n\t\t{$color1},\r\n\t\t{$color1} 6px,\r\n\t\t{$color2} 6px,\r\n\t\t{$color2} 12px\r\n\t\t);\r\n\t");
echo $out->render();
示例5: array
$this_state = $state;
$date_content = NULL;
$this_state['date'] = $this_date;
$date_content = HC_Html_Factory::widget('module')->set_url($rootlink . '/day')->pass_arg(array($this_shifts, $this_state))->set_params($this_state)->set_param('date', $this_date)->add_attr('class', 'hc-rfr-' . 'dat-' . $this_date);
$CELLS[$this_date] = $date_content;
/* links */
$LINKS[$this_date] = NULL;
if ($can_add) {
$href_details = array('date' => $this_date, 'type' => $test_shift->_const('TYPE_SHIFT'));
if (isset($state['staff']) && $state['staff'] && count($state['staff']) == 1) {
$href_details['user'] = $state['staff'][0];
}
if (isset($state['location']) && $state['location'] && count($state['location']) == 1) {
$href_details['location'] = $state['location'][0];
}
$btns = HC_Html_Factory::element('a')->add_attr('href', HC_Lib::link('shifts/add/index')->url($href_details))->add_attr('class', 'hc-flatmodal-loader')->add_attr('class', 'btn')->add_attr('class', 'btn-archive')->add_attr('class', 'display-block')->add_attr('style', 'text-align: center;')->add_attr('class', 'btn-sm')->add_child(HCM::__('Add'))->add_child(HC_Html::icon('plus'))->add_attr('title', HCM::__('Add'));
$LINKS[$this_date] = $btns;
}
}
/* stats view */
$quickstats_view = HC_Html_Factory::widget('module')->set_url($rootlink . '/quickstats')->pass_arg(array($shifts, $this_state))->set_show_empty(TRUE)->add_attr('class', 'hc-rfr');
foreach ($this_state as $k => $v) {
if ($v or $v === 0) {
$quickstats_view->set_param($k, $v);
}
}
$QUICKSTATS = $quickstats_view;
/* form view */
$QUICKFORM = NULL;
if ($form) {
$quickform_view = HC_Html_Factory::widget('module')->set_url($rootlink . '/quickform')->pass_arg(array($shifts, $this_state))->set_show_empty(TRUE)->add_attr('class', 'hc-rfr')->set_self_target(FALSE);
示例6: array
<?php
if (!$count) {
return;
}
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list-toff/index', array('filter' => 'pending-timeoffs'));
$title = HC_Html_Factory::widget('list')->add_attr('class', 'list-inline')->add_attr('class', 'list-separated')->add_item('title', HC_Html_Factory::widget('titled', 'a')->add_attr('href', $linkto)->add_child(HCM::__('Pending Timeoff Requests')))->add_item('count', HC_Html_Factory::element('span')->add_attr('class', 'badge')->add_child($count));
$out = HC_Html_Factory::element('div')->add_attr('class', 'alert')->add_attr('class', 'alert-archive')->add_child($title);
$color = '#eee';
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
$out->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t-45deg,\r\n\t\t{$color1},\r\n\t\t{$color1} 6px,\r\n\t\t{$color2} 6px,\r\n\t\t{$color2} 12px\r\n\t\t);\r\n\t");
echo $out->render();
示例7: foreach
<?php
$link = HC_Lib::link('list/' . $tab, $state);
$rootlink_this = HC_Lib::link($rootlink . '/' . $tab, $state);
$rootlink = HC_Lib::link($rootlink, $state);
$current_user_id = $this->auth->user()->id;
/* FILTER STAFF */
$filter1 = NULL;
if (count($all_staffs) > 1) {
$filter1 = HC_Html_Factory::widget('filter');
$filter1->set_btn_size('xs')->set_link($rootlink_this)->set_param_name('staff')->set_title(HCM::__('Staff'))->set_panel('default');
foreach ($all_staffs as $oid => $obj) {
$filter1->set_option($oid, $obj->present_title());
}
if (isset($state['staff'])) {
$filter1->set_selected($state['staff']);
}
}
/* FILTER LOCATIONS */
$filter2 = NULL;
if (count($all_locations) > 1) {
$filter2 = HC_Html_Factory::widget('filter');
$filter2->set_btn_size('xs')->set_link($rootlink_this)->set_param_name('location')->set_title(HCM::__('Location'))->set_panel('default');
foreach ($all_locations as $oid => $obj) {
$attr = array('style' => 'background-color: ' . $obj->present_color() . ';');
$filter2->set_option($oid, $obj->present_title(), $attr);
}
if (isset($state['location'])) {
$filter2->set_selected($state['location']);
}
}
示例8: array
<?php
$current_user_id = $this->auth->check();
$display_form = HC_Html_Factory::widget('form')->add_attr('action', HC_Lib::link('admin/users/update/index/' . $object->id))->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
/* BUTTONS */
$buttons = HC_Html_Factory::widget('list')->add_attr('class', array('list-inline', 'list-separated'));
if (!$form->readonly()) {
$buttons->add_item(HC_Html_Factory::element('input')->add_attr('type', 'submit')->add_attr('class', array('btn', 'btn-default'))->add_attr('title', HCM::__('Save'))->add_attr('value', HCM::__('Save')));
}
if ($object->id != $current_user_id) {
$buttons->add_divider();
if ($object->active == USER_HC_MODEL::STATUS_ACTIVE) {
$buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('admin/users/update/index/' . $object->id . '/active/' . USER_HC_MODEL::STATUS_ARCHIVE))->add_attr('class', array('btn', 'btn-warning-o'))->add_attr('class', array('btn-sm'))->add_attr('class', array('hc-confirm'))->add_attr('title', HCM::__('Archive User'))->add_child(HCM::__('Archive User')));
} else {
$buttons->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('admin/users/update/index/' . $object->id . '/active/' . USER_HC_MODEL::STATUS_ACTIVE))->add_attr('class', array('btn', 'btn-success-o'))->add_attr('class', array('btn-sm'))->add_attr('class', array('hc-confirm'))->add_attr('title', HCM::__('Restore User'))->add_child(HCM::__('Restore User')));
}
}
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('First Name'))->set_content($form->input('first_name')->add_attr('size', 24))->set_error($form->input('first_name')->error()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Last Name'))->set_content($form->input('last_name')->add_attr('size', 24))->set_error($form->input('last_name')->error()))->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Email'))->set_content($form->input('email')->add_attr('size', 32))->set_error($form->input('email')->error()));
$app_conf = HC_App::app_conf();
if ($app_conf->get('login_with') == 'username') {
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Username'))->set_content($form->input('username')->add_attr('size', 24))->set_error($form->input('username')->error()));
}
$input_level = $form->input('level')->set_options(array(USER_HC_MODEL::LEVEL_STAFF => HCM::__('Staff'), USER_HC_MODEL::LEVEL_MANAGER => HCM::__('Manager'), USER_HC_MODEL::LEVEL_ADMIN => HCM::__('Admin')));
/* can't change own level */
if ($object->id == $this->auth->check()) {
// $input_level->add_attr('disabled', 'disabled');
$input_level->set_readonly();
}
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('User Level'))->set_content($input_level)->set_error($input_level->error())->set_content_static($input_level->readonly()));
$display_form->add_item(HC_Html_Factory::widget('label_row')->set_content($buttons));
echo $display_form->render();
示例9: redirect
function redirect($to = '', $parent_refresh = array())
{
$parent = 0;
if ($this->input->is_ajax_request()) {
// if( $this->input->post() )
// {
// clear flash
$this->session->set_flashdata('message', NULL);
$this->session->set_flashdata('error', NULL);
// }
if (!is_array($to) && $to == '-referrer-') {
} else {
// already starts with http:// ?
if (!HC_Lib::is_full_url($to)) {
$to = HC_Lib::link($to);
$to = $to->url();
}
}
$out = array('redirect' => $to, 'parent' => $parent, 'parent_refresh' => $parent_refresh);
$this->output->set_content_type('application/json');
$this->output->enable_profiler(FALSE);
echo json_encode($out);
hc_ci_before_exit();
exit;
// return;
} else {
if (!is_array($to) && $to == '-referrer-') {
$to = (!isset($_SERVER['HTTP_REFERER']) or $_SERVER['HTTP_REFERER'] == '') ? '' : trim($_SERVER['HTTP_REFERER']);
}
HC_Lib::redirect($to);
return;
}
return;
}
示例10: array_keys
$link = HC_Lib::link('conf/admin/update/' . $tab);
$this->layout->set_partial('header', HC_Html::page_header(HC_Html_Factory::element('h2')->add_child(HCM::__('Settings'))));
/* check if we need tabs */
$these_fields = array_keys($fields);
if (count($tabs) > 1) {
$menubar = HC_Html_Factory::widget('list');
$menubar->add_attr('class', array('nav', 'nav-tabs'));
$app_conf = HC_App::app_conf();
foreach ($tabs as $tk => $ms) {
$conf_key = 'menu_conf_settings:' . $tk;
$tab_label = $app_conf->conf($conf_key);
if ($tab_label === FALSE) {
$tab_label = $tk;
}
$menubar->add_item($tk, HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('conf/admin/index/' . $tk))->add_child($tab_label));
}
$menubar->set_active($tab);
echo $menubar->render();
$these_fields = $tabs[$tab];
}
$display_form = HC_Html_Factory::widget('form')->add_attr('action', $link->url())->add_attr('class', 'form-horizontal')->add_attr('class', 'form-condensed');
foreach ($these_fields as $fn) {
$f = $fields[$fn];
$field_input = $form->input($fn);
switch ($f['type']) {
case 'dropdown':
$field_input->set_options($f['options']);
break;
case 'checkbox_set':
$field_input->set_options($f['options']);
示例11: switch
}
if ($added) {
$user_item->add_child($more_wrap);
}
}
}
$item->add_item($user_item);
}
}
break;
}
switch ($this_tab) {
case 'user':
if ($tab != 'more_user') {
if ($params->get('type') != $temp_shift->_const('TYPE_TIMEOFF') or $remain_users > 0) {
// $item->add_divider();
$item->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('shifts/add/add_user')->url($params->to_array()))->add_attr('class', array('btn'))->add_attr('class', array('btn-default'))->add_attr('class', array('btn-archive'))->add_attr('class', array('btn-sm'))->add_child(HC_Html::icon('plus') . ' ' . HCM::__('Add Staff')));
$item = HC_Html_Factory::widget('list')->add_attr('class', 'list-unstyled')->add_attr('class', 'list-separated')->add_item($item);
}
}
$item = HC_Html_Factory::widget('label_row')->set_label(HCM::__('Staff'))->set_content($item);
break;
default:
break;
}
if ($item) {
$menubar->add_item($this_tab, $item);
}
}
}
echo $menubar->render();
示例12: _grab_state
//.........这里部分代码省略.........
if (in_array($cuk, $state['staff'])) {
$current_user_key = $cuk;
break;
}
}
if ($current_user_key) {
$current_user_id = 0;
if ($test_user = $this->auth->user()) {
$current_user_id = $test_user->id;
}
$state['staff'] = HC_Lib::replace_in_array($state['staff'], $current_user_key, $current_user_id);
}
}
/* fixed ? */
$force_fixed = array('location', 'staff');
foreach ($default_params as $k => $v) {
if (in_array($k, $force_fixed)) {
$this->fix[$k] = $state[$k];
}
}
switch ($state['range']) {
case 'all':
$t = HC_Lib::time();
$shifts = HC_App::model('shift');
$min_date = $shifts->select_min('date')->get()->date;
$max_date = $shifts->select_max('date_end')->get()->date_end;
if ($min_date && $max_date) {
$state['date'] = $min_date . '_' . $max_date;
}
break;
case 'upcoming':
$t = HC_Lib::time();
$shifts = HC_App::model('shift');
$min_date = $t->setNow()->formatDate_Db();
$max_date = $shifts->select_max('date_end')->get()->date_end;
if ($min_date && $max_date) {
$state['date'] = $min_date . '_' . $max_date;
}
break;
case 'day':
case 'week':
case 'month':
if (!$state['date']) {
$t->setNow();
$state['date'] = $t->formatDate_Db();
}
break;
case 'custom':
if (strpos($state['date'], '_') !== FALSE) {
list($start_date, $end_date) = explode('_', $state['date']);
} else {
$start_date = $end_date = $state['date'];
}
$t->setNow();
if (!$start_date) {
$start_date = $t->formatDate_Db();
}
if (!$end_date) {
$end_date = $t->formatDate_Db();
}
$state['date'] = join('_', array($start_date, $end_date));
break;
default:
// attempt to parse the range text in time
$start_date = $state['date'];
if (!$start_date) {
$t->setNow();
$start_date = $t->formatDate_Db();
}
$t->setDateDb($start_date);
$t->modify('+' . $state['range']);
$end_date = $t->formatDate_Db();
$state['date'] = join('_', array($start_date, $end_date));
$state['range'] = 'custom';
break;
}
/* if custom dates supplied */
if (isset($supplied['customdates']) && $supplied['customdates']) {
$post = $this->input->post();
if (isset($post['start_date']) && isset($post['end_date'])) {
if ($post['end_date'] <= $post['start_date']) {
$post['end_date'] = $post['start_date'];
}
$state['date'] = $post['start_date'] . '_' . $post['end_date'];
$state['range'] = 'custom';
unset($state['customdates']);
$link = HC_Lib::link($this->views_path . '/' . $tab, $state);
$redirect_to = $link->url();
$this->redirect($redirect_to);
return;
}
}
/* something fixed ? */
foreach ($this->fix as $fk => $fv) {
if ($fv) {
unset($state[$fk]);
}
}
return $state;
}
示例13: count
<?php
$link = HC_Lib::link('shifts/add/insert');
/* count how many shifts will be created */
$pa = $params->to_array();
$shifts_count = 1;
$shifts_count *= count($dates);
$check = array('location', 'user');
foreach ($check as $ch) {
if (is_array($pa[$ch])) {
$shifts_count *= count($pa[$ch]);
}
}
$display_form = HC_Html_Factory::widget('form')->add_attr('action', $link->url($params->to_array()))->add_attr('class', 'form-condensed')->add_attr('class', 'form-small-labels');
$out = HC_Html_Factory::widget('list')->add_attr('class', array('list-unstyled', 'list-separated'));
/* STATUS CHECKBOX */
$status_input = NULL;
$statuses = $params->get_options('status');
if (count($statuses) > 1) {
$status_input = $form->input('status');
$status_input->set_inline(TRUE);
foreach ($statuses as $status_option) {
$status_input->add_option($status_option, $model->set('status', $status_option)->present_status());
}
} elseif (count($statuses) == 1) {
reset($statuses);
$status_input = $model->set('status', key($statuses))->present_status();
}
if ($status_input !== NULL) {
$out->add_item(HC_Html_Factory::widget('label_row')->set_label(HCM::__('Status'))->set_content($status_input));
}
示例14: get_admin_url
} else {
$user_title .= $user->email;
}
$user_title .= ']';
$link_profile = 'auth/profile';
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link($link_profile))->add_child($user_title));
$auth_user = $this->auth->user();
$acl = HC_App::acl();
$acl_user = $acl->user();
$ri = HC_Lib::ri();
if ($auth_user->id != $acl_user->id) {
if ($ri == 'wordpress') {
if ($auth_user->level >= $auth_user->_const('LEVEL_MANAGER')) {
$nav->add_divider();
$app = HC_App::app();
$admin_url = get_admin_url() . 'admin.php?page=' . $app;
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', $admin_url)->add_child(HC_Html::icon('cogs'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Admin Area'))));
}
}
}
$nav->add_divider();
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/logout'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log Out')))->add_child(HC_Html::icon('sign-out')));
} else {
if ($this_method != 'login') {
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link('auth/login'))->add_child(HC_Html::icon('sign-in'))->add_child(HC_Html_Factory::element('span')->add_attr('class', 'hidden-xs')->add_child(HCM::__('Log In'))));
} else {
$nav->add_item(HC_Html_Factory::widget('titled', 'a')->add_attr('href', HC_Lib::link())->add_child(HC_Html::icon('arrow-left'))->add_child(HCM::__('Back To Start Page')));
}
}
$out->add_child($nav);
echo $out->render();
示例15: sprintf
<?php
if (!$count) {
return;
}
$title = sprintf(HCM::_n('%d Pending Timeoff Request', '%d Pending Timeoff Requests', $count), $count);
$temp_shift = HC_App::model('shift');
$linkto = HC_Lib::link('list/browse', array('type' => $temp_shift->_const('TYPE_TIMEOFF'), 'status' => $temp_shift->_const('STATUS_DRAFT'), 'range' => 'upcoming'));
$item = HC_Html_Factory::widget('titled', 'a')->add_attr('class', 'display-block')->add_attr('href', $linkto)->add_attr('class', 'alert')->add_attr('class', 'alert-archive')->add_attr('title', $title)->add_child($title);
echo $item->render();