本文整理汇总了PHP中Link::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::url方法的具体用法?PHP Link::url怎么用?PHP Link::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::url方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
global $CFG;
$tab_id = $CFG->pm_editor ? $CFG->id : Control::getPageId($CFG->url, 1);
if (!$tab_id > 0) {
return false;
}
$current_tab = DB::getRecord('admin_tabs', $tab_id, 0, 1);
$pages = self::getPages($tab_id);
if ($pages) {
$HTML = '
<div class="page_map">';
foreach ($pages as $page) {
if ($CFG->pm_editor) {
$edit = '<a href="#" title="' . $CFG->edit_hover_caption . '" class="edit" class="method_edit_button" onclick="pmPageEdit(' . $page['id'] . ',event);return false;"></a>';
}
$order = $page['order'];
$icon = $page['icon'] ? '<div class="lnk">' . Link::url($page['url'], '<img src="' . $page['icon'] . '" title="' . $page['name'] . '" />', false, false, false, 'content') . '</div>' : '';
$pages_array[$order][] = '
<div class="page_map_page o">
<input type="hidden" id="id" value="' . $page['id'] . '" />
' . $icon . '
<div class="lnk">' . Link::url($page['url'], $page['name'], false, false, false, 'content') . '</div>
' . $edit . '
<div class="clear"></div>
</div>';
}
$total = max(array_keys($pages_array));
$total = $total + count($this->areas_s);
$total = $total + count($this->areas_e);
for ($i = 0; $i <= $total; $i++) {
if ($this->areas_s[$i]) {
foreach ($this->areas_s[$i] as $area) {
$HTML .= $area;
}
}
if ($pages_array[$i]) {
foreach ($pages_array[$i] as $p) {
$HTML .= $p;
}
}
if ($this->areas_e[$i]) {
foreach ($this->areas_e[$i] as $area) {
$HTML .= $area;
}
}
}
$HTML .= '</div>';
} else {
$HTML .= '<div class="no_pages">' . $CFG->pagemap_nothing . '</div>';
}
echo $HTML;
}
示例2: showPath
public static function showPath()
{
global $CFG;
if ($_REQUEST['tab_bypass']) {
return false;
}
if ($CFG->url) {
$sql = "SELECT admin_tabs.name AS tab_name,admin_tabs.url AS tab_url" . (!$CFG->is_tab ? ",admin_pages.name AS page_name, admin_pages.url AS page_url" : '') . " FROM admin_tabs" . (!$CFG->is_tab ? ",admin_pages" : '') . " WHERE 1 " . (!$CFG->is_tab ? "AND admin_pages.url = '{$CFG->url}' AND admin_pages.f_id = admin_tabs.id" : " AND admin_tabs.url = '{$CFG->url}'");
$result = db_query_array($sql);
}
echo '<div class="path">';
echo '<a href="' . $CFG->self . '">' . $CFG->home_label . '</a>';
if ($result) {
echo $CFG->path_separator;
echo !empty($result[0]['tab_url']) ? Link::url($result[0]['tab_url'], $result[0]['tab_name'], false, array('is_tab' => 1)) : $result[0]['tab_name'];
if (!$CFG->is_tab) {
echo $CFG->path_separator;
echo !empty($result[0]['page_url']) ? Link::url($result[0]['page_url'], $result[0]['page_name']) : $result[0]['page_name'];
}
if ($CFG->action) {
if ($CFG->action == 'form') {
$action = $CFG->path_edit;
} elseif ($CFG->action == 'record') {
$action = $CFG->path_view;
}
echo $CFG->path_separator . $action;
}
} else {
if (!$CFG->url) {
echo $CFG->path_separator . $CFG->path_ctrl;
} else {
switch ($CFG->url) {
case 'edit_tabs':
echo $CFG->path_separator . $CFG->path_edit_tabs;
break;
case 'users':
echo $CFG->path_separator . $CFG->path_users;
break;
case 'settings':
echo $CFG->path_separator . $CFG->path_settings;
break;
}
}
}
echo '</div>';
}
示例3: filterFirstLetter
function filterFirstLetter($field_name, $subtable = false)
{
global $CFG;
$properties = array('field_name' => $field_name, 'type' => 'first_letter', 'subtable' => $subtable);
$range = range('A', 'Z');
$HTML = '';
foreach ($range as $l) {
$HTML .= Link::url($this->go_to_url, $l, 'fl=' . $l . '&fl_field=' . $field_name . '&fl_subtable=' . $subtable . '&is_tab=' . $this->go_to_is_tab, false, false, 'content');
}
$CFG->o_method_id = $CFG->method_id;
$CFG->o_method_name = 'filterFirstLetter';
self::HTML($HTML);
$CFG->o_method_suppress = true;
self::HTML('<input type="hidden" name="filter_properties[' . $field_name . ']" value="' . urlencode(serialize($properties)) . '" />');
}
示例4: elseif
$width_class = 'triple';
} elseif ($c > 5) {
$split = ceil($c / 2);
$width_class = 'double';
}
echo '
<div class="menu_item">
' . Link::url($tab['url'], $tab['name'] . ($pages ? '<div class="drop"></div>' : ''), false, array('is_tab' => 1));
if ($pages) {
$i = 0;
echo '
<div class="options ' . $width_class . '">
<div class="contain">
<ul>';
foreach ($pages as $page) {
echo '<li>' . Link::url($page['url'], $page['name']) . '</li>';
$i++;
if ($split && $i % $split == 0) {
echo '<div class="clear"></div></ul><ul>';
}
}
echo '
<div class="clear"></div>
</ul>
<div class="t_shadow"></div>
<div class="r_shadow"></div>
<div class="b_shadow"></div>
<div class="l_shadow"></div>
<div class="tl1_shadow"></div>
<div class="tl2_shadow"></div>
<div class="tr1_shadow"></div>
示例5: link
function link($url = false, $caption = false, $variables = false, $target_elem_id = false, $class = false, $disable_if_no_record_id = false, $disable_if_cant_edit = false)
{
global $CFG;
$reserved_keywords = array('current_url', 'action', 'bypass', 'is_tab');
if (is_array($variables)) {
foreach ($variables as $k => $v) {
$v1 = str_replace('[', '', str_replace(']', '', $v));
if (in_array($k, $reserved_keywords)) {
$variables1[$k] = $v;
} elseif ($k == 'id') {
$variables1[$k] = $this->record_id;
} elseif ($v1 == 'id') {
$variables1["{$url}[{$k}]"] = $this->record_id;
} else {
$variables1["{$url}[{$k}]"] = $this->row[$v1];
}
}
}
$variables1['bypass_save'] = 1;
$permission_level = $variables1['action'] == 'form' ? 2 : 1;
$disabled = User::permission(0, 0, $url, false, $variables1['is_tab']) < $permission_level;
$disabled = !($this->record_id > 0) && $disable_if_no_record_id ? true : $disabled;
$target_elem_id = !$target_elem_id ? 'content' : $target_elem_id;
$class = $class ? $class : 'nav_link';
if ($CFG->pm_editor) {
$method_name = Form::peLabel($CFG->method_id, 'link');
}
$this->HTML[] = Link::url($url, '<div class="add_new"></div> ' . $caption, false, $variables1, false, $target_elem_id, $class, false, false, false, $disabled) . $method_name;
}
示例6: show
private function show($comments)
{
global $CFG;
if ($comments) {
echo '<ul>';
foreach ($comments as $comment) {
$elapsed = time() + Settings::mysqlTimeDiff() * 3600 - strtotime($comment['date']);
if ($elapsed < 60) {
$time_ago = $CFG->comments_less_than_minute;
} elseif ($elapsed > 60 && $elapsed < 60 * 60) {
$minutes = floor($elapsed / 60);
$time_ago = str_ireplace('[field]', $minutes, $CFG->comments_minutes_ago);
} elseif ($elapsed > 60 * 60 && $elapsed < 60 * 60 * 24) {
$hours = floor($elapsed / 60 / 60);
$time_ago = str_ireplace('[field]', $hours, $CFG->comments_hours_ago);
} elseif ($elapsed > 60 * 60 * 24 && $elapsed < 60 * 60 * 24 * 30.4) {
$days = floor($elapsed / 60 / 60 / 24);
$time_ago = str_ireplace('[field]', $days, $CFG->comments_days_ago);
} else {
$months = floor($elapsed / 60 / 60 / 24 / 30.4);
$time_ago = str_ireplace('[field]', $months, $CFG->comments_months_ago);
}
if ($comment['user_id'] > 0) {
$user = DB::getRecord($this->user_table, $comment['user_id'], false, true);
$name = !empty($comment['website']) ? Link::url($comment['website'], $user['user']) : $user['user'];
} else {
$name = !empty($comment['website']) ? Link::url($comment['website'], $comment['name']) : $comment['name'];
}
$short = $this->short_version ? '_short' : '';
$icon = $comment['type'] ? eval('return $CFG->comment_type_' . $comment['type'] . ';') : $CFG->comment_type_1;
$action = $comment['type'] ? eval('return $CFG->comments_action_' . $comment['type'] . $short . ';') : $CFG->comments_wrote_label;
$action = String::doFormulaReplacements($action, unserialize($comment['f_table_row']), 1, 1);
echo '
<li id="comment_' . $comment['id'] . '" class="level_' . $comment['type'] . '">
<div class="c_head">';
if ($this->fields) {
foreach ($this->fields as $f_name => $field) {
$CFG->o_method_id = $field['method_id'];
$CFG->o_method_name = 'field';
$record = new Record($field['table'], $comment['record_id']);
echo '<div class="added_field">' . $record->field($field['name'], $field['caption'], $field['subtable'], $field['subtable_fields'], $field['link_url'], $field['concat_char'], true, $field['f_id_field'], $field['order_by'], $field['order_asc'], $comment['record_id'], $field['link_is_tab'], $field['limit_is_curdate'], false, $field['link_id_field']) . '</div>';
}
}
echo '
' . $icon . ' ' . $name . ' (' . $time_ago . ') ' . $action . '
</div>';
if (!$this->short_version) {
echo '
<div class="c_comment">
' . (strlen($comment['comments']) != strlen(strip_tags($comment['comments'])) ? $comment['comments'] : nl2br($comment['comments'])) . '
</div>';
}
echo '
' . ($comment['type'] <= 1 && !$this->short_version ? '<div class="c_reply"><a href="#" onclick="showReplyBox(' . $comment['id'] . ',' . $this->i . ');return false;">' . $CFG->comments_reply_label . '</a></div>' : '') . '
<div class="c_form"></div>
</li>';
if (is_array($comment['children'])) {
Comments::show($comment['children']);
}
}
echo '<div style="clear:both;height:0;"></div></ul>';
}
}
示例7: pagination
function pagination($page, $total_rows, $rows_per_page = 0, $max_pages = 0, $pagination_label = false, $target_elem = false)
{
global $CFG;
$page = $page > 0 ? $page : 1;
$target_elem = $target_elem ? $target_elem : 'content';
if (is_object($this)) {
if ($this->max_pages == 1) {
return false;
}
$rows_per_page = $this->rows_per_page;
$max_pages = $this->max_pages ? $this->max_pages : 10;
$pagination_label = $this->pagination_label;
$link_url = $CFG->url;
$mode = $this->mode;
$inset_id = $this->inset_id;
$inset_id_field = $this->inset_id_field;
$inset_i = $this->inset_i;
$target_elem = $this->inset_i > 0 ? 'inset_area_' . $this->inset_i : $target_elem;
$grid_i = $this->i;
$filter_results = $_REQUEST['form_filters' . $this->i];
} else {
$link_url = $CFG->url;
}
if (!($rows_per_page > 0)) {
return false;
}
if ($total_rows > $rows_per_page) {
$num_pages = ceil($total_rows / $rows_per_page);
$page_array = range(1, $num_pages);
if ($max_pages > 0) {
$p_deviation = ($max_pages - 1) / 2;
$alpha = $page - 1;
$alpha = $alpha < $p_deviation ? $alpha : $p_deviation;
$beta = $num_pages - $page;
$beta = $beta < $p_deviation ? $beta : $p_deviation;
if ($alpha < $p_deviation) {
$beta = $beta + ($p_deviation - $alpha);
}
if ($beta < $p_deviation) {
$alpha = $alpha + ($p_deviation - $beta);
}
}
if ($page != 1) {
$first_page = Link::url($link_url, $CFG->first_page_text, false, array('page' . $grid_i => 1, 'p_bypass' . $grid_i => 1, 'mode' . $grid_i => $mode, 'inset_id' => $inset_id, 'inset_id_field' => $inset_id_field, 'inset_i' => $inset_i, 'form_filters' . $grid_i => $filter_results, 'search_fields' . $grid_i => $_REQUEST['search_fields' . $grid_i]), true, $target_elem, 'first');
}
if ($page != $num_pages) {
$last_page = Link::url($link_url, $CFG->last_page_text, false, array('page' . $grid_i => $num_pages, 'p_bypass' . $grid_i => 1, 'mode' . $grid_i => $mode, 'inset_id' => $inset_id, 'inset_id_field' => $inset_id_field, 'inset_i' => $inset_i, 'form_filters' . $grid_i => $filter_results, 'search_fields' . $grid_i => $_REQUEST['search_fields' . $grid_i]), true, $target_elem, 'last');
}
$pagination = '<div class="pagination"><div style="float:left;">' . $first_page;
foreach ($page_array as $p) {
if ($p >= $page - $alpha && $p <= $page + $beta || $max_pages == 0) {
if ($p == $page) {
$pagination .= ' <span>' . $p . '</span> ';
} else {
$pagination .= Link::url($link_url, $p, false, array('page' . $grid_i => $p, 'p_bypass' . $grid_i => 1, 'mode' . $grid_i => $mode, 'inset_id' => $inset_id, 'inset_id_field' => $inset_id_field, 'inset_i' => $inset_i, 'form_filters' . $grid_i => $filter_results, 'search_fields' . $grid_i => $_REQUEST['search_fields' . $grid_i]), true, $target_elem);
}
}
}
$pagination .= '</div>';
if ($pagination_label) {
$label = str_ireplace('[results]', '<b>' . $total_rows . '</b>', $CFG->pagination_label);
$label = str_ireplace('[num_pages]', '<b>' . $num_pages . '</b>', $label);
$pagination .= '<div style="float:right" class="pagination_label">' . $label . '</div>';
}
$pagination .= $last_page . '<div style="clear:both;height:0;"> </div></div>';
return $pagination;
}
}
示例8: show_filters
function show_filters()
{
global $CFG;
if ($this->inset_id > 0) {
return false;
}
if (is_array($this->filters)) {
$form_filters = new Form('form_filters', false, 'GET', 'form_filters', false);
$form_filters->show_errors();
$form_filters->info = $form_filters->info ? $form_filters->info : $this->filter_results;
foreach ($this->filters as $filter) {
$name = $filter['field_name'];
$caption = !empty($filter['caption']) ? $caption : $name;
if ($filter['type'] != 'radio' && $filter['type'] != 'start_date' && $filter['type'] != 'end_date' && $group) {
$form_filters->endGroup();
$group = false;
}
switch ($filter['type']) {
case 'per_page':
$options_array = is_array($filter['options_array']) ? $filter['options_array'] : array(10 => 10, 30 => 30, 50 => 50);
$caption = !empty($filter['caption']) ? $filter['caption'] : $CFG->results_per_page_text;
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterPerPage';
$form_filters->selectInput('per_page', $caption, false, $this->rows_per_page, $options_array, false, false, false, false, $filter['class']);
break;
case 'search':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterSearch';
$form_filters->textInput('search', $filter['caption'], false, false, false, false, $filter['class']);
foreach ($filter['subtable_fields'] as $s_field => $s_subtable) {
$s_subtable = $s_subtable && $s_subtable != $s_field ? $s_subtable : $this->table;
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="search_fields[' . $s_field . ']" value="' . $s_subtable . '" />');
}
break;
case 'autocomplete':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterAutocomplete';
$form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class']);
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable]" value="' . $filter['subtable'] . '" />');
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable_fields]" value="' . implode('|', $filter['subtable_fields']) . '" />');
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][f_id_field]" value="' . $filter['f_id_field'] . '" />');
break;
case 'tokenizer':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterTokenizer';
$form_filters->autoComplete($name, $filter['caption'], false, $filter['value'], false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, false, false, false, false, false, false, false, false, false, 1);
break;
case 'cats':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterCats';
$form_filters->catSelect($filter['subtable'], $filter['caption'], 0, $filter['class'], false, false, false, $filter['subtable_fields'], $filter['concat_char']);
break;
case 'first_letter':
$range = range('A', 'Z');
$HTML = '';
foreach ($range as $l) {
$HTML .= Link::url($this->link_url, $l, 'fl=' . $l . '&fl_field=' . $name . '&fl_subtable=' . $filter['subtable'] . '&is_tab=' . $this->is_tab, false, false, 'content');
}
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterFirstLetter';
$form_filters->HTML($HTML);
break;
case 'select':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterSelect';
$form_filters->selectInput($name, $filter['caption'], false, false, $filter['options_array'], $filter['subtable'], $filter['subtable_fields'], false, false, $filter['class'], false, false, $filter['f_id_field'], false, $filter['depends_on']);
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable]" value="' . $filter['subtable'] . '" />');
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][subtable_fields]" value="' . implode('|', $filter['subtable_fields']) . '" />');
$CFG->o_method_suppress = true;
$form_filters->HTML('<input type="hidden" name="subtables[' . $name . '][f_id_field]" value="' . $filter['f_id_field'] . '" />');
break;
case 'checkbox':
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterCheckbox';
$form_filters->checkBox($name, $filter['caption'], false, false, $filter['class'], false, false, $filter['checked']);
break;
case 'radio':
if (!$group) {
$CFG->o_method_suppress = true;
$form_filters->startGroup();
}
$CFG->o_method_id = $filter['method_id'];
$CFG->o_method_name = 'filterRadio';
$form_filters->radioInput($name, $filter['caption'], false, $filter['value'], false, $filter['class'], false, false, $filter['checked']);
if (!$group) {
$group = true;
} else {
$CFG->o_method_suppress = true;
$form_filters->endGroup();
$group = false;
}
break;
case 'start_date':
$CFG->o_method_id = $filter['method_id'];
//.........这里部分代码省略.........
示例9: display
function display()
{
global $CFG;
self::getSteps();
$HTML = '
<div class="flow_chart">
<table>
<tr>
<td class="bar">
<a class="add_step" title="' . $CFG->add_step . '" onclick="flow_chart.addStep()"></a>
<a class="save_order" title="' . $CFG->save_order . '" onclick="flow_chart.saveOrder()"></a>
</td>
</tr>
<tr>
<td class="navigator" id="navigator">
<input type="hidden" id="table" value="' . $this->table . '" />
<input type="hidden" id="current_url" value="' . $CFG->url . '" />
<input type="hidden" id="is_tab" value="' . $CFG->is_tab . '" />';
if ($this->steps) {
foreach ($this->steps as $i => $step) {
$HTML .= '
<div class="step_container">
<div class="ops">';
if (User::permission(0, 0, $this->table, false, $this->url_is_tab) > 0) {
$HTML .= Link::url($this->table, false, 'id=' . $step['id'] . '&action=record&is_tab=' . $this->url_is_tab, false, false, 'edit_box', 'view', false, false, false, false, $CFG->view_hover_caption) . ' ';
}
if (User::permission(0, 0, $this->table, false, $this->url_is_tab) > 1) {
$HTML .= Link::url($this->table, false, 'id=' . $step['id'] . '&action=form&is_tab=' . $this->url_is_tab, false, false, 'edit_box', 'edit', false, false, false, false, $CFG->edit_hover_caption) . ' ';
}
if (User::permission(0, 0, $this->table, false, $this->url_is_tab) > 1) {
$HTML .= '<a href="#" title="' . $CFG->delete_hover_caption . '" onclick="flow_chart.deleteThis(' . $step['id'] . ',\'' . $this->table . '\',this)" class="delete"></a>';
}
$HTML .= '
</div>
<div class="step" onclick="flow_chart.select(this,event);" ondblclick="flow_chart.open(' . $step['id'] . ')"></div>
<div class="desc" onclick="flow_chart.select(this,event);" ondblclick="flow_chart.open(' . $step['id'] . ')">' . $step['name'] . '</div>
<input type="hidden" id="id" value="' . $step['id'] . '" />
</div>';
if ($this->steps[$i + 1]) {
$HTML .= '<div class="step_link"></div>';
}
}
}
if (!$CFG->pm_editor) {
$HTML .= '
<script language="text/javascript">
$("#navigator").click(function() {
flow_chart.unselect();
});
flow_chart.startSortable();
</script>
';
}
$HTML .= '
<div class="clear"></div>
</td>
</tr>
</table>
</div>
';
echo $HTML;
}
示例10: testInvalidRouteName
/**
* @expectedException \Ignaszak\Router\RouterException
*/
public function testInvalidRouteName()
{
$this->urlGenerator = new UrlGenerator($this->mockRoute());
$this->urlGenerator->url('name', []);
}
示例11: display
function display()
{
global $CFG;
if (!is_array($this->tables) || !is_array($this->fields)) {
return false;
}
if ($CFG->pm_editor) {
echo '</ul>';
}
$mode = $this->mode;
$date = $this->date;
$y = $this->y;
$m = $this->m;
$d = $this->d;
$this->days_in_month = cal_days_in_month(0, $m, $y);
if (!$mode || $mode == 'month') {
$first_day = mktime(0, 0, 0, $m, 1, $y);
$title = date('F', $first_day) . ' ' . $y;
$day_of_week = date('w', $first_day);
$days_array = range(1, $this->days_in_month);
$start = $first_day;
$end = mktime(23, 59, 59, $m, $this->days_in_month, $y);
$next = strtotime('+1 month', $first_day);
$next_5 = strtotime('+5 month', $first_day);
$prev = strtotime('-1 month', $first_day);
$prev_5 = strtotime('-5 month', $first_day);
} elseif ($mode == 'week') {
$day_of_week = date('w', $date);
$first_day = date('j', strtotime('-' . $day_of_week . ' day', $date));
$start = strtotime('-' . $day_of_week, $date);
$end = strtotime('+' . (6 - $day_of_week), $date);
$title = $CFG->cal_week_from . ' ' . date($CFG->default_date_format, strtotime('-' . $day_of_week . ' day', $date)) . ' ' . $CFG->cal_week_until . ' ' . date($CFG->default_date_format, strtotime('+' . (6 - $day_of_week) . ' day', $date));
$next = strtotime('+1 week', $first_day);
$next_5 = strtotime('+5 week', $first_day);
$prev = strtotime('-1 week', $first_day);
$prev_5 = strtotime('-5 week', $first_day);
for ($i = 0; $i <= 6; $i++) {
$days_array[] = date('j', strtotime("+{$i} day", $start));
}
} elseif ($mode == 'day') {
$refer_mode = $_REQUEST['cal_' . $this->i . '_refer_mode'];
$s_hour = $this->start_time ? $this->start_time : 0;
$e_hour = $this->end_time ? $this->end_time : 23;
$start = mktime(0, 0, 0, $m, $d, $y);
$end = mktime(23, 59, 59, $m, $d, $y);
$title = date('D F j, Y', $start);
$next = strtotime('+1 day', $start);
$next_5 = strtotime('+5 day', $start);
$prev = strtotime('-1 day', $start);
$prev_5 = strtotime('-5 day', $start);
$days_array[] = $this->date;
}
$this->data = self::get($start, $end);
if (!$this->print) {
$day_class = $mode == 'day' ? 'calendar_day' : '';
$HTML = "\n\t\t\t<div class=\"area full_box calendar {$class} {$day_class}\" id=\"cal_{$this->i}\">\n\t\t\t\t<h2>{$title}</h2>\n\t\t\t\t<div class=\"box_bar\"></div>\n\t\t\t\t<div class=\"box_tl\"></div>\n\t\t\t\t<div class=\"box_tr\"></div>\n\t\t\t\t<div class=\"box_bl\"></div>\n\t\t\t\t<div class=\"box_br\"></div>\n\t\t\t\t<div class=\"t_shadow\"></div>\n\t\t\t\t<div class=\"r_shadow\"></div>\n\t\t\t\t<div class=\"b_shadow\"></div>\n\t\t\t\t<div class=\"l_shadow\"></div>\n\t\t\t\t<div class=\"box_b\"></div>\n\t\t\t\t<div class=\"grid_buttons\"><div class=\"button before\"></div>";
if (is_array($this->add_buttons)) {
foreach ($this->add_buttons as $button) {
$string = $button['table'];
if (substr($string, -1) == 's') {
$string = substr($string, 0, -1);
}
$HTML .= Link::url($button['table'], '<div class="add_new"></div>' . $CFG->add_new_caption . ' ' . ucfirst($string), '&action=form&is_tab=' . $button['is_tab'], false, false, $button['target_elem_id'], 'button');
}
}
$HTML .= (User::permission(0, 0, $CFG->url) > 1 ? "<a href=\"#\" onclick=\"saveCalOrder()\" class=\"button\"><div class=\"save\"></div> {$CFG->save_caption}</a>" : '') . '<a href="#" onclick="printCal(' . $this->i . ')" class="button"><div class="print"></div>' . $CFG->print_caption . '</a>';
if ($this->mode_switching && ($mode == 'day' || $mode == 'week')) {
$HTML .= Link::url($CFG->url, '<div class="cal_icon"></div>' . $CFG->cal_view_month, false, array('cal_' . $this->i . '_y' => date('Y', $start), 'cal_' . $this->i . '_m' => date('n', $start), 'cal_bypass' => 1, 'bypass' => 1, 'cal_' . $this->i . '_mode' => 'month'), true, 'cal_' . $this->i, 'button');
}
$HTML .= '
<div class="button after"></div></div><div class="contain">' . Link::url($CFG->url, 'hidden', false, array('cal_' . $this->i . '_y' => $this->y, 'cal_' . $this->i . '_m' => $this->m, 'cal_' . $this->i . '_d' => $this->d, 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode, 'print' => 1), true, false, 'cal_print_link', false, '_blank') . "\n\t\t\t\t<table cellspacing=\"0\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan=\"" . (!$mode || $mode == 'month' ? 7 : ($mode == 'week' ? 8 : 2)) . "\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<div onclick=\"synchCalDates(" . date('Y', $prev_5) . "," . date('n', $prev_5) . "," . date('j', $prev_5) . ")\" class=\"n1 n\">" . Link::url($CFG->url, '<<', false, array('cal_' . $this->i . '_y' => date('Y', $prev_5), 'cal_' . $this->i . '_m' => date('n', $prev_5), 'cal_' . $this->i . '_d' => date('j', $prev_5), 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode), true, 'cal_' . $this->i) . "</div>\n\t\t\t\t\t\t\t<div onclick=\"synchCalDates(" . date('Y', $prev) . "," . date('n', $prev) . "," . date('j', $prev) . ")\" class=\"n2 n\">" . Link::url($CFG->url, '<', false, array('cal_' . $this->i . '_y' => date('Y', $prev), 'cal_' . $this->i . '_m' => date('n', $prev), 'cal_' . $this->i . '_d' => date('j', $prev), 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode), true, 'cal_' . $this->i) . "</div>\n\t\t\t\t\t\t\t<div onclick=\"synchCalDates(" . date('Y', time()) . "," . date('n', time()) . "," . date('j', time()) . ")\" class=\"n_today n\">" . Link::url($CFG->url, $CFG->cal_today, false, array('cal_' . $this->i . '_y' => date('Y', time()), 'cal_' . $this->i . '_m' => date('n', time()), 'cal_' . $this->i . '_d' => date('j', time()), 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode), true, 'cal_' . $this->i) . "</div>\n\t\t\t\t\t\t\t<div onclick=\"synchCalDates(" . date('Y', $next) . "," . date('n', $next) . "," . date('j', $next) . ")\" class=\"n3 n\">" . Link::url($CFG->url, '>', false, array('cal_' . $this->i . '_y' => date('Y', $next), 'cal_' . $this->i . '_m' => date('n', $next), 'cal_' . $this->i . '_d' => date('j', $next), 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode), true, 'cal_' . $this->i) . "</div>\n\t\t\t\t\t\t\t<div onclick=\"synchCalDates(" . date('Y', $next_5) . "," . date('n', $next_5) . "," . date('j', $next_5) . ")\" class=\"n4 n\">" . Link::url($CFG->url, '>>', false, array('cal_' . $this->i . '_y' => date('Y', $next_5), 'cal_' . $this->i . '_m' => date('n', $next_5), 'cal_' . $this->i . '_d' => date('j', $next_5), 'cal_bypass' => 1, 'bypass' => 1, 'mode' => $mode), true, 'cal_' . $this->i) . "</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</th>\n\t\t\t\t</tr>\n\t\t\t";
if ($this->tokenizers && $this->mode == 'day') {
foreach ($this->tokenizers as $t_name => $t_values) {
if (is_array($t_values)) {
$HTML .= '<tr><td class="datasets" colspan="' . (!$mode || $mode == 'month' ? 7 : ($mode == 'week' ? 8 : 2)) . '">';
foreach ($t_values as $t_value) {
$HTML .= '<div>' . $t_value . '</div>';
}
$HTML .= "</td></tr>";
}
}
}
if (!$mode || $mode == 'month') {
$alt = $alt ? '' : 'class="alt"';
$HTML .= "\n\t\t\t\t\t<tr {$alt}>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_sun}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_mon}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_tue}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_wed}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_thur}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_fri}</td>\n\t\t\t\t\t\t<td class=\"c_day\">{$CFG->cal_sat}</td>\n\t\t\t\t\t</tr>";
$day_count = 1;
$HTML .= "<tr>";
$i = $day_of_week;
while ($i > 0) {
$HTML .= '<td class="inactive"></td>';
$i--;
$day_count++;
}
foreach ($days_array as $day_num) {
$events = self::getEvents(false, false, $day_num);
$current = $day_num == date('j') && $m == date('n') && $y == date('Y') ? 'current' : '';
$HTML .= "\n\t\t\t\t\t<td class=\"{$current}\" onmouseover=\"calCellHover(this)\" onmouseout=\"calCellOut(this)\" onclick=\"calZoomDay({$this->i},'{$CFG->url}',{$CFG->is_tab},{$y},{$m},{$day_num})\">\n\t\t\t\t\t\t<div class=\"wrap\">\n\t\t\t\t\t\t\t<div class=\"day_num\">{$day_num}</div>";
if (is_array($events)) {
foreach ($events as $k => $dataset) {
@reset($this->tokenizers);
//.........这里部分代码省略.........
示例12: displayItems
private function displayItems($tables, $rows = false, $f_id = 0, $level = 1, $p_id = 0)
{
global $CFG;
$pm_method = $CFG->pm_editor ? ' class="pm_method"' : '';
if ($tables) {
$parent_id = $rows ? $p_id : $f_id;
$this->levels[$level][$parent_id] = $parent_id;
$HTML = '';
foreach ($tables as $name => $properties) {
$HTML .= "<ul id=\"mlist_{$this->i}_level_{$level}_{$parent_id}\" class=\"mlist_{$this->i}_level_{$level}\">";
$properties['url'] = empty($properties['url']) ? $CFG->url : $properties['url'];
$properties['url_is_tab'] = empty($properties['url_is_tab']) ? $CFG->is_tab : $properties['url_is_tab'];
if (!empty($properties['parent']) && $f_id == 0) {
continue;
}
$HTML .= "<input id=\"table\" type=\"hidden\" name=\"table\" value=\"{$name}\" />";
$HTML .= "<input id=\"enabled\" type=\"hidden\" name=\"enabled\" value=\"{$this->dragdrop}\" />";
$HTML .= "<input id=\"p_id\" type=\"hidden\" name=\"p_id\" value=\"{$p_id}\" />";
$HTML .= "<input id=\"f_id\" type=\"hidden\" name=\"f_id\" value=\"{$f_id}\" />";
if ($CFG->pm_editor) {
$HTML .= Form::peLabel($properties['method_id'], 'addTable');
}
$table = $rows ? $rows : DB::getCats($name, $f_id);
if ($table) {
foreach ($table as $id => $row) {
$hidden = $row['row']['hidden'] == 'Y' ? 'hidden' : '';
$HTML .= "<li id=\"{$row['row']['id']}\" class=\"li_{$level} ml_li {$hidden}\">";
$HTML .= !empty($row['children']) ? '<div onclick="ml_expand(this)" class="more"></div><div onclick="ml_collapse(this)" class="less"></div>' : '';
$HTML .= "<div class=\"ml_item\">";
if ($CFG->url == 'edit_tabs' && !empty($row['row']['url'])) {
$is_tab = $name == 'admin_tabs' ? '1' : '0';
if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) {
$HTML .= '<a class="edit_page" href="index.php?current_url=edit_page&table=' . $name . '&id=' . $row['row']['id'] . '&is_tab=' . $is_tab . '"></a>';
}
}
if (is_array($properties['table_fields'])) {
foreach ($properties['table_fields'] as $field) {
$value = Grid::detectData($field, $row['row'][$field], $this->fields[$name]);
$HTML .= !empty($properties['url']) ? Link::url($properties['url'], $row['row'][$field], "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : $value;
}
$del_function = $CFG->url == 'edit_tabs' ? 'deletePage(this)' : 'ml_delete(this)';
if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) {
$HTML .= Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'view', false, false, false, false, $CFG->view_hover_caption) . Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'edit', false, false, false, false, $CFG->edit_hover_caption) . "<a href=\"#\" class=\"delete\" title=\"{$CFG->delete_hover_caption}\" onclick=\"{$del_function}\" class=\"button\"></a>";
}
} else {
foreach ($row['row'] as $field) {
$HTML .= '<span>' . $field . '</span>';
}
}
$HTML .= $this->row_end_button ? $this->row_end_button : '';
if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1 && $accepts_children) {
$HTML .= $properties['accept_children'] ? Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : '';
}
$HTML .= '</div>';
if (!empty($row['children'])) {
$HTML .= MultiList::displayItems(array($name => $properties), $row['children'], false, $level + 1, $id);
}
foreach ($this->tables as $name1 => $properties1) {
if ($properties1['parent'] == $name) {
$HTML .= MultiList::displayItems(array($name1 => $properties1), false, $id, $level + 1);
}
}
$HTML .= '</li>';
}
}
$HTML .= '</ul>';
$HTML .= "<div class=\"add_elem\">" . Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $CFG->is_tab, false, false, $properties['target_elem_id']) . "</div>";
}
return $HTML;
}
}