本文整理汇总了PHP中HC_Lib::adjust_color_brightness方法的典型用法代码示例。如果您正苦于以下问题:PHP HC_Lib::adjust_color_brightness方法的具体用法?PHP HC_Lib::adjust_color_brightness怎么用?PHP HC_Lib::adjust_color_brightness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HC_Lib
的用法示例。
在下文中一共展示了HC_Lib::adjust_color_brightness方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
示例3: 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());
}
//.........这里部分代码省略.........
示例4: status
function status($model, $vlevel = HC_PRESENTER::VIEW_HTML)
{
list($label_text, $label_class) = $this->_status_details($model);
$label_class = $this->status_class($model, TRUE);
$type_text = $model->present_type(HC_PRESENTER::VIEW_RAW);
switch ($vlevel) {
case HC_PRESENTER::VIEW_HTML:
case HC_PRESENTER::VIEW_HTML_ICON:
// $return = HC_Html::label( $label_class, $label_text );
// $type_label = $model->present_label( $vlevel );
// $label_text = $type_label . $label_text;
$label_text_text = $model->present_status(HC_PRESENTER::VIEW_RAW);
$return = HC_Html_Factory::widget('titled', 'span')->add_attr('class', array('alert'))->add_attr('class', array('alert-condensed2'))->add_attr('title', $label_text_text)->add_child($label_text);
if (!is_array($label_class)) {
$label_class = array($label_class);
}
foreach ($label_class as $lc) {
// $return->add_attr('class', 'alert-' . $lc);
// $return->add_attr('class', 'alert-' . $lc);
}
// $return->add_attr('class', 'alert-default-o');
// $color = $model->location->present_color();
$type = $model->type;
switch ($type) {
case $model->_const('TYPE_TIMEOFF'):
$color = '#ddd';
$color = '#eee';
break;
default:
$color = '#dff0d8';
// $color = Hc_lib::random_html_color( 2 );
break;
}
if ($model->status == $model->_const('STATUS_DRAFT')) {
$color1 = HC_Lib::adjust_color_brightness($color, 0);
$color2 = HC_Lib::adjust_color_brightness($color, 20);
$return->add_attr('style', "background: repeating-linear-gradient(\n\t\t\t\t\t\t\t-45deg,\n\t\t\t\t\t\t\t{$color1},\n\t\t\t\t\t\t\t{$color1} 6px,\n\t\t\t\t\t\t\t{$color2} 6px,\n\t\t\t\t\t\t\t{$color2} 12px\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t");
} else {
$return->add_attr('style', 'background-color: ' . $color . ';');
// $wrap->add_attr('class', 'alert-success');
}
break;
case HC_PRESENTER::VIEW_TEXT:
$return = join(': ', array(HCM::__('Status'), $type_text, $label_text));
break;
case HC_PRESENTER::VIEW_RAW:
$type_label = $model->present_label($vlevel);
$return = join(': ', array($type_text, $label_text));
break;
}
return $return;
}