本文整理汇总了PHP中HC_Lib::remove_from_array方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::remove_from_array方法的具体用法?PHP HC_Lib::remove_from_array怎么用?PHP HC_Lib::remove_from_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::remove_from_array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$sh = $this->shift();
$t = HC_Lib::time();
$titles = array();
$iknow = $this->iknow();
$wide = $this->wide();
$use_color = FALSE;
$use_color = TRUE;
if ($wide && $wide === 'mini') {
$use_color = TRUE;
}
if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
$display = array('date', 'time', 'user', 'location');
} else {
if (!$wide or $wide === 'mini') {
$display = array('date', 'time', 'location', 'user');
} elseif ($wide) {
$display = array('date', 'time', 'user', 'location');
}
}
foreach ($iknow as $ik) {
$display = HC_Lib::remove_from_array($display, $ik);
}
// if( in_array($sh->type, array($sh->_const("TYPE_TIMEOFF"))) ){
// $display = HC_Lib::remove_from_array($display, 'location');
// }
foreach ($display as $ds) {
$title_view = '';
switch ($ds) {
case 'date':
$title_view = $sh->present_date(HC_PRESENTER::VIEW_RAW);
break;
case 'time':
$title_view = $sh->present_time();
break;
case 'location':
if (in_array($sh->type, array($sh->_const("TYPE_TIMEOFF")))) {
$title_view = '';
// $title_view = HCM::__('Timeoff');
// $title_view = $sh->present_location();
} else {
$title_view = $sh->present_location();
}
break;
case 'user':
if ($sh->type == $sh->_const('TYPE_TIMEOFF') && !in_array('time', $display)) {
$title_view = $sh->present_type(HC_PRESENTER::VIEW_HTML_ICON) . $sh->present_user(HC_PRESENTER::VIEW_RAW);
} else {
// $titles[] = $sh->present_user();
if ($sh->user_id) {
$title_view = $sh->present_user(HC_PRESENTER::VIEW_RAW);
} else {
$title_view = $sh->present_user();
}
}
break;
}
// if( $title_view ){
$titles[] = $title_view;
// }
}
$wrap = HC_Html_Factory::element('div')->add_attr('class', array('alert', 'display-block'))->add_attr('class', array('alert-default-o'))->add_attr('class', array('no-underline'))->add_attr('class', array('alert-condensed2'))->add_attr('class', array('text-smaller'))->add_attr('class', array('squeeze-in'));
foreach ($sh->present_status_class() as $status_class) {
// $wrap->add_attr('class', 'alert-' . $status_class);
}
/* background color depends on location */
if ($use_color) {
$color = $sh->location->present_color();
} else {
$type = $sh->type;
switch ($type) {
case $sh->_const('TYPE_TIMEOFF'):
$wrap->add_attr('class', array('alert-archive'));
$color = '#ddd';
break;
default:
$wrap->add_attr('class', array('alert-success-o'));
$color = '#dff0d8';
break;
}
}
if ($sh->status == $sh->_const('STATUS_DRAFT')) {
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
// $color1 = '#fff';
// $color2 = '#eee';
$wrap->add_attr('style', "background: repeating-linear-gradient(\r\n\t\t\t\t\t-45deg,\r\n\t\t\t\t\t{$color1},\r\n\t\t\t\t\t{$color1} 6px,\r\n\t\t\t\t\t{$color2} 6px,\r\n\t\t\t\t\t{$color2} 12px\r\n\t\t\t\t\t);\r\n\t\t\t\t");
} else {
$wrap->add_attr('style', 'background-color: ' . $color . ';');
// $wrap->add_attr('class', 'alert-success');
}
if (!$sh->user_id) {
$wrap->add_attr('class', 'hc-red-triangled');
}
// echo $color;
/* ID */
if (in_array('id', $iknow)) {
$wrap->add_child($sh->present_id());
}
//.........这里部分代码省略.........
示例2: url
function url()
{
$return = NULL;
$append_controller = '';
$change_params = array();
$args = func_get_args();
$ri = HC_Lib::ri();
if ($ri && count($args) == 0 && count($this->params) == 0) {
switch ($this->controller) {
case 'auth/login':
$return = Modules::run($ri . '/auth/login_url');
break;
case 'auth/logout':
$return = Modules::run($ri . '/auth/logout_url');
break;
}
}
if ($return) {
return $return;
}
if (count($args) == 1) {
list($change_params) = $args;
} elseif (count($args) == 2) {
list($append_controller, $change_params) = $args;
}
$slug = array();
if ($this->controller) {
$slug[] = $this->controller;
}
if ($append_controller) {
$slug[] = $append_controller;
}
$params = array_merge($this->params, $change_params);
$params = $this->params;
foreach ($change_params as $k => $v) {
if (substr($k, -1) == '+' or substr($k, -1) == '-') {
$operation = substr($k, -1);
$k = substr($k, 0, -1);
if (isset($params[$k])) {
if (!is_array($params[$k])) {
$params[$k] = array($params[$k]);
}
} else {
$params[$k] = array();
}
if ($operation == '+') {
$params[$k][] = $v;
} else {
$params[$k] = HC_Lib::remove_from_array($params[$k], $v);
}
} else {
$params[$k] = $v;
}
}
foreach ($params as $k => $v) {
if (is_array($v)) {
if (!$v) {
continue;
}
$v = join('.', $v);
}
if ($v !== NULL) {
$slug[] = $k;
$slug[] = $v;
}
}
$CI =& ci_get_instance();
$return = $CI->config->site_url($slug);
return $return;
}