示例#1
0
function show_field_ln($pdf, $value, $text = '')
{
    global $line, $col;
    if (0 == $col) {
        $pdf->Cell(2, 0, "", 0, 0);
    }
    $pdf->Cell((1.6 * strlen($value) + strlen($text)) * 0.22, 0.8, $text . strtoupper($value), 0, 1, 'L');
    draw_line($pdf, (strlen($text) + $col) * 0.2, (strlen($text) + strlen($value) * 1.6 + $col) * 0.2);
    ++$line;
    $col = 0;
}
function show_field($pdf, $label, $value)
{
    $ln = strlen($label);
    if ($ln < 55) {
        $ln = 55;
    }
    $pdf->Cell(0, 0.3, sprintf("%-{$ln}s", "{$label} :"), 0, 0, 'L');
    $pdf->Cell(0, 0, "{$value}                                                ", 0, 1, 'R');
    $pdf->Cell(0, 0.6, '', 0, 1, 'L');
    $pdf->Cell(1.6, 0, "", 0, 0);
    draw_line($pdf, $ln);
}
示例#3
0
文件: cd.php 项目: romlg/cms36
 function draw_tree()
 {
     global $tree_result, $ids;
     $root_query = mysql_query("select * " . (LANG_SELECT ? ", name_" . lang() . " as name" : "") . " from `{$this->table}` ORDER BY priority");
     $id = 0;
     while ($result = mysql_fetch_array($root_query)) {
         $tree_result[] = $result;
         $ids[$result['id']] = $id;
         $id++;
     }
     echo '<b>Выберите разделы, которые войдут в презентацию:</b><p>';
     $ret = '';
     $pid_query = mysql_query("select id from tree where id=pid");
     while ($pid_result = mysql_fetch_array($pid_query)) {
         echo draw_line($pid_result['id'], false, $this->cd_table);
     }
     return $ret;
 }
示例#4
0
    public function DrawViewMode()
    {
        $this->IncludeJSFunctions();
        $this->BeforeViewRecords();
        $sorting_fields = self::GetParameter('sorting_fields');
        $sorting_types = self::GetParameter('sorting_types');
        $page = self::GetParameter('page');
        $total_pages = $page;
        $rid = self::GetParameter('rid');
        $action = self::GetParameter('action');
        $operation = self::GetParameter('operation');
        $operation_type = self::GetParameter('operation_type');
        $operation_field = self::GetParameter('operation_field');
        $search_status = self::GetParameter('search_status');
        $concat_sign = preg_match('/\\?/', $this->formActionURL) ? '&' : '?';
        $colspan = count($this->arrViewModeFields) + 1;
        $start_row = 0;
        $total_records = 0;
        $sort_by = '';
        $export_content = array();
        $calendar_fields = array();
        $nl = "\n";
        // prepare changing of language
        //----------------------------------------------------------------------
        if ($operation == 'change_language' && $operation_type != '' && strlen($operation_type) == 2) {
            $this->languageId = $operation_type;
            // added to prevent search with entered word on changing language
            $search_status = '';
        }
        // prepare sorting data
        //----------------------------------------------------------------------
        if ($this->isSortingAllowed) {
            if ($operation == 'sorting') {
                if ($sorting_fields != '') {
                    if ($action == 'delete') {
                        // $sorting_types
                    } else {
                        if (strtolower($sorting_types) == 'asc') {
                            $sorting_types = 'DESC';
                        } else {
                            $sorting_types = 'ASC';
                        }
                    }
                    $sort_type = isset($this->arrViewModeFields[$sorting_fields]['sort_type']) ? $this->arrViewModeFields[$sorting_fields]['sort_type'] : 'string';
                    $sort_by = isset($this->arrViewModeFields[$sorting_fields]['sort_by']) ? $this->arrViewModeFields[$sorting_fields]['sort_by'] : $sorting_fields;
                    if ($sort_type == 'numeric') {
                        $this->ORDER_CLAUSE = ' ORDER BY ABS(' . $sort_by . ') ' . $sorting_types . ' ';
                    } else {
                        $this->ORDER_CLAUSE = ' ORDER BY ' . $sort_by . ' ' . $sorting_types . ' ';
                    }
                } else {
                    $sorting_types = 'ASC';
                }
            } else {
                if ($sorting_fields != '' && $sorting_types != '') {
                    $this->ORDER_CLAUSE = ' ORDER BY ' . $sorting_fields . ' ' . $sorting_types . ' ';
                }
            }
        }
        // prepare filtering data
        //----------------------------------------------------------------------
        if ($this->isFilteringAllowed) {
            if ($search_status == 'active') {
                if ($this->WHERE_CLAUSE == '') {
                    $this->WHERE_CLAUSE .= ' WHERE 1=1 ';
                }
                $count = 0;
                foreach ($this->arrFilteringFields as $key => $val) {
                    $custom_handler = isset($val['custom_handler']) ? $val['custom_handler'] : false;
                    if (!$custom_handler && self::GetParameter('filter_by_' . $val['table'] . $val['field'], false) !== '') {
                        $sign = '=';
                        $sign_start = '';
                        $sign_end = '';
                        if ($val['sign'] == '=') {
                            $sign = '=';
                        } else {
                            if ($val['sign'] == '>=') {
                                $sign = '>=';
                            } else {
                                if ($val['sign'] == '<=') {
                                    $sign = '<=';
                                } else {
                                    if ($val['sign'] == 'like%') {
                                        $sign = 'LIKE';
                                        $sign_end = '%';
                                    } else {
                                        if ($val['sign'] == '%like') {
                                            $sign = 'LIKE';
                                            $sign_start = '%';
                                        } else {
                                            if ($val['sign'] == '%like%') {
                                                $sign = 'LIKE';
                                                $sign_start = '%';
                                                $sign_end = '%';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        $key_value = self::GetParameter('filter_by_' . $val['table'] . $val['field'], false);
                        if (isset($val['table']) && $val['table'] != '') {
                            $field_name = $val['table'] . '.' . $val['field'];
                        } else {
                            $field_name = $val['field'];
                        }
                        $date_format = isset($val['date_format']) ? $val['date_format'] : '';
                        $type = isset($val['type']) ? $val['type'] : '';
                        if ($type == 'calendar') {
                            $key_value = $this->PrepareDateTime($key_value, $date_format);
                        }
                        if ($this->IsSecureField($key, $val)) {
                            $field_name = $this->UncryptValue($field_name, $val, false);
                        }
                        $this->WHERE_CLAUSE .= ' AND ' . $field_name . ' ' . $sign . ' \'' . $sign_start . mysql_real_escape_string($key_value) . $sign_end . '\' ';
                    }
                }
            }
        }
        // prepare paging data
        //----------------------------------------------------------------------
        if ($this->isPagingAllowed) {
            if (!is_numeric($page) || (int) $page <= 0) {
                $page = 1;
            }
            // set sql_mode to empty if you have Mixing of GROUP columns SQL issue - in connection.php file
            /// database_void_query('SET sql_mode = ""');
            $sql = preg_replace('/SELECT\\b/i', 'SELECT COUNT(*) as mg_total_records, ', $this->VIEW_MODE_SQL, 1) . ' ' . $this->WHERE_CLAUSE . ' LIMIT 0, 1';
            if ($this->debug) {
                $start_time = $this->GetFormattedMicrotime();
            }
            $result = database_query($sql, DATA_AND_ROWS, FIRST_ROW_ONLY);
            if ($this->debug) {
                $finish_time = $this->GetFormattedMicrotime();
            }
            $total_records = isset($result[0]['mg_total_records']) ? (int) $result[0]['mg_total_records'] : '1';
            if ($this->debug) {
                if (!mysql_error()) {
                    $this->arrSQLs['total_records_sql'] = '<i>Total Records</i> | T: ' . round((double) $finish_time - (double) $start_time, 4) . ' sec. <br>' . $sql;
                } else {
                    $this->arrErrors['total_records_sql'] = $sql . '<br>' . mysql_error();
                }
            }
            if ($this->pageSize == 0) {
                $this->pageSize = '10';
            }
            $total_pages = (int) ($total_records / $this->pageSize);
            // when you back from other languages where more pages than on current
            if ($page > $total_pages + 1) {
                $page = 1;
            }
            if ($total_records % $this->pageSize != 0) {
                $total_pages++;
            }
            $start_row = ($page - 1) * $this->pageSize;
        }
        // check if there is move operation and perform it
        //----------------------------------------------------------------------
        if ($operation == 'move') {
            // block if this is a demo mode
            if (strtolower(SITE_MODE) == 'demo') {
                $this->error = _OPERATION_BLOCKED;
            } else {
                $operation_field_p = explode('#', $operation_field);
                $operation_field_p0 = explode('-', $operation_field_p[0]);
                $operation_field_p1 = explode('-', $operation_field_p[2]);
                $of_first = isset($operation_field_p0[0]) ? $operation_field_p0[0] : '';
                $of_second = isset($operation_field_p0[1]) ? $operation_field_p0[1] : '';
                $of_name = $operation_field_p[1];
                $of_first_value = isset($operation_field_p1[0]) ? $operation_field_p1[0] : '';
                $of_second_value = isset($operation_field_p1[1]) ? $operation_field_p1[1] : '';
                if ($of_first_value != '' && $of_second_value != '') {
                    $sql = 'UPDATE ' . $this->tableName . ' SET ' . $of_name . ' = \'' . $of_second_value . '\' WHERE ' . $this->primaryKey . ' = \'' . $of_first . '\'';
                    database_void_query($sql);
                    if ($this->debug) {
                        $this->arrSQLs['select_move_1'] = $sql;
                    }
                    $sql = 'UPDATE ' . $this->tableName . ' SET ' . $of_name . ' = \'' . $of_first_value . '\' WHERE ' . $this->primaryKey . ' = \'' . $of_second . '\'';
                    database_void_query($sql);
                    if ($this->debug) {
                        $this->arrSQLs['select_move_2'] = $sql;
                    }
                }
            }
        }
        $arrRecords = $this->GetAll($this->ORDER_CLAUSE, 'LIMIT ' . $start_row . ', ' . (int) $this->pageSize);
        if ($this->allowLanguages) {
            $arrLanguages = Languages::GetAllActive();
        }
        if (!$this->isPagingAllowed) {
            $total_records = $arrRecords[1];
        }
        echo '<form name="frmMicroGrid_' . $this->tableName . '" id="frmMicroGrid_' . $this->tableName . '" action="' . $this->formActionURL . '" method="post">' . $nl;
        draw_hidden_field('mg_prefix', $this->uPrefix);
        echo $nl;
        draw_hidden_field('mg_action', 'view');
        echo $nl;
        draw_hidden_field('mg_rid', '');
        echo $nl;
        draw_hidden_field('mg_sorting_fields', $sorting_fields);
        echo $nl;
        draw_hidden_field('mg_sorting_types', $sorting_types);
        echo $nl;
        draw_hidden_field('mg_page', $page);
        echo $nl;
        draw_hidden_field('mg_operation', $operation);
        echo $nl;
        draw_hidden_field('mg_operation_type', $operation_type);
        echo $nl;
        draw_hidden_field('mg_operation_field', $operation_field);
        echo $nl;
        draw_hidden_field('mg_search_status', $search_status);
        echo $nl;
        draw_hidden_field('mg_language_id', $this->languageId);
        echo $nl;
        draw_hidden_field('mg_operation_code', self::GetRandomString(20));
        echo $nl;
        draw_token_field();
        echo $nl;
        if ($this->actions['add'] || $this->allowLanguages || $this->allowRefresh || $this->isExportingAllowed) {
            echo '<table width="100%" border="0" cellspacing="0" cellpadding="2" class="mgrid_table">
				<tr>';
            echo '<td align="' . Application::Get('defined_left') . '" valign="middle">';
            if ($this->actions['add']) {
                echo '<input class="mgrid_button" type="button" name="btnAddNew" value="' . _ADD_NEW . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'add\');">&nbsp;&nbsp;&nbsp;';
            }
            if ($this->operationLinks != '') {
                echo $this->operationLinks;
            }
            echo '</td>';
            echo '<td align="' . Application::Get('defined_right') . '" valign="middle">';
            if ($this->isExportingAllowed) {
                if (strtolower(SITE_MODE) == 'demo' || !$arrRecords[1]) {
                    echo '<span class="gray">[ ' . _EXPORT . ' ]</span> &nbsp;';
                } else {
                    if ($operation == 'switch_to_export') {
                        echo '[ <a href="javascript:void(\'export|cancel\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', null, null, null, null, \'switch_to_normal\');" title="' . _SWITCH_TO_NORMAL . '">' . _BUTTON_CANCEL . '</a> | ' . _DOWNLOAD . ' - <a href="javascript:void(\'csv\');" onclick="javascript:appGoToPage(\'index.php?admin=export&file=export.csv\')"><img src="images/microgrid_icons/csv.gif" alt="' . _DOWNLOAD . ' CSV"></a> ] &nbsp;';
                    } else {
                        echo '<a href="javascript:void(\'export\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', null, null, null, null, \'switch_to_export\');" title="' . _SWITCH_TO_EXPORT . '">[ ' . _EXPORT . ' ]</a> &nbsp;';
                    }
                }
            }
            if ($this->allowRefresh) {
                echo '<a href="javascript:void(\'refresh\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\');" title="' . _REFRESH . '"><img src="images/microgrid_icons/refresh.gif" alt="' . _REFRESH . '"></a>';
            }
            echo '</td>';
            if ($this->allowLanguages) {
                echo '<td align="' . Application::Get('defined_right') . '" width="80px">';
                $this->allowLanguages ? draw_languages_box('mg_language_id', $arrLanguages[0], 'abbreviation', 'lang_name', $this->languageId, '', 'onchange="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', null, null, null, null, \'change_language\', this.value, \'language_id\');"') : '';
                echo '</td>';
            }
            echo '
				</tr>
				<tr><td nowrap height="10px"></td></tr>
			</table>';
        }
        if ($this->isFilteringAllowed) {
            echo '<table width="100%" border="0" cellspacing="0" cellpadding="2" class="mgrid_table">
				<tr>
					<td align="' . Application::Get('defined_left') . '">';
            echo '<b>' . _FILTER_BY . '</b>: &nbsp;&nbsp;&nbsp;';
            foreach ($this->arrFilteringFields as $key => $val) {
                if (!$this->IsVisible($val)) {
                    continue;
                }
                $filter_field_value = $search_status == 'active' ? self::GetParameter('filter_by_' . $val['table'] . $val['field'], false) : '';
                if ($val['type'] == 'text') {
                    echo $key . ':&nbsp;<input type="text" class="mgrid_text" name="filter_by_' . $val['table'] . $val['field'] . '" value="' . $this->GetDataDecoded($filter_field_value) . '" style="width:' . $val['width'] . '" maxlength="125">&nbsp;&nbsp;&nbsp;';
                } else {
                    if ($val['type'] == 'dropdownlist') {
                        if (is_array($val['source'])) {
                            echo $key . ':&nbsp;<select class="mgrid_text" name="filter_by_' . $val['table'] . $val['field'] . '" style="width:' . $val['width'] . '">';
                            echo '<option value="">-- ' . _SELECT . ' --</option>';
                            foreach ($val['source'] as $key => $val) {
                                echo '<option ' . ($filter_field_value !== '' && $filter_field_value == $key ? ' selected="selected"' : '') . ' value="' . $this->GetDataDecoded($key) . '">' . $val . '</option>';
                            }
                            echo '</select>&nbsp;&nbsp;&nbsp;';
                        }
                    } else {
                        if ($val['type'] == 'calendar') {
                            $date_format = isset($val['date_format']) ? $val['date_format'] : '';
                            if ($date_format == 'mm/dd/yyyy') {
                                $calendar_date_format = '%m-%d-%Y';
                                $placeholder_date_format = 'mm-dd-yyyy';
                            } else {
                                if ($date_format == 'dd/mm/yyyy') {
                                    $calendar_date_format = '%d-%m-%Y';
                                    $placeholder_date_format = 'dd-mm-yyyy';
                                } else {
                                    $calendar_date_format = '%Y-%m-%d';
                                    $placeholder_date_format = 'yyyy-dd-mm';
                                }
                            }
                            echo $key . ':&nbsp;<input type="text" id="filter_cal' . $val['field'] . '" class="mgrid_text" name="filter_by_' . $val['table'] . $val['field'] . '" value="' . $this->GetDataDecoded($filter_field_value) . '" style="width:' . $val['width'] . '" maxlength="19" placeholder="' . $placeholder_date_format . '">&nbsp;';
                            echo '<img id="filter_cal' . $val['field'] . '_img" src="images/microgrid_icons/cal.gif" alt="" title="' . _SET_TIME . '" style="cursor:pointer;">';
                            echo '&nbsp;&nbsp;';
                            $calendar_fields[] = array('field' => 'filter_cal' . $val['field'], 'format' => $calendar_date_format);
                        }
                    }
                }
            }
            if (count($this->arrFilteringFields) > 0) {
                echo '&nbsp;';
                if ($search_status == 'active') {
                    echo ' <input type="button" class="mgrid_button" name="btnReset" value="' . _BUTTON_RESET . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'\', \'\', \'\', \'\', \'reset_filtering\');">';
                }
                echo ' <input type="button" class="mgrid_button" name="btnSearch" value="' . _SEARCH . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'\', \'\', \'\', \'\', \'filtering\')">';
            }
            echo '	</td>
				</tr>
				<tr><td nowrap height="10px"></td></tr>
			</table>';
        }
        // draw rows
        if ($arrRecords[1] > 0) {
            echo '<table width="100%" border="' . ($this->debug ? '1' : '0') . '" cellspacing="0" cellpadding="2" class="mgrid_table">';
            // draw column headers
            echo '<tr>';
            foreach ($this->arrViewModeFields as $key => $val) {
                $width = isset($val['width']) ? ' width="' . $val['width'] . '"' : '';
                if (isset($val['align']) && $val['align'] == 'left' && Application::Get('defined_left') == 'right') {
                    $align = ' align="right"';
                } else {
                    if (isset($val['align']) && $val['align'] == 'right' && Application::Get('defined_right') == 'left') {
                        $align = ' align="left"';
                    } else {
                        if (isset($val['align'])) {
                            $align = ' align="' . $val['align'] . '"';
                        } else {
                            $align = '';
                        }
                    }
                }
                $visible = isset($val['visible']) && $val['visible'] !== '' ? $val['visible'] : true;
                $sortable = isset($val['sortable']) && $val['sortable'] !== '' ? $val['sortable'] : true;
                $th_class = $key == $sort_by ? ' class="th_sorted"' : '';
                $title = isset($val['title']) ? $val['title'] : '';
                if ($visible) {
                    echo '<th' . $width . $align . $th_class . '>';
                    if ($this->isSortingAllowed && $sortable) {
                        $field_sorting = 'DESC';
                        $sort_icon = '';
                        if ($key == $sorting_fields) {
                            if (strtolower($sorting_types) == 'asc') {
                                $sort_icon = ' <img src="images/microgrid_icons/up.png" alt="" title="asc">';
                            } else {
                                if (strtolower($sorting_types) == 'desc') {
                                    $sort_icon = ' <img src="images/microgrid_icons/down.png" alt="" title="desc">';
                                }
                            }
                            $field_sorting = $sorting_types;
                        }
                        echo '<a href="javascript:void(\'sort\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'\', \'' . $key . '\', \'' . $field_sorting . '\', \'' . $page . '\', \'sorting\')"><b>' . $title . '</b></a>' . $sort_icon;
                        $this->DrawHeaderTooltip($val);
                    } else {
                        echo '<label>' . $title . '</label>';
                    }
                    echo '</th>';
                    if ($operation == 'switch_to_export' && strtolower(SITE_MODE) != 'demo') {
                        $export_content[0][] = $val['title'];
                    }
                }
            }
            if ($this->actions['details'] || $this->actions['edit'] || $this->actions['delete']) {
                echo '<th width="8%">' . _ACTIONS . '</th>';
            }
            echo '</tr>';
            echo '<tr><td colspan="' . $colspan . '" height="3px" nowrap="nowrap">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            for ($i = 0; $i < $arrRecords[1]; $i++) {
                echo '<tr ' . ($this->isAlterColorsAllowed ? highlight(0) : '') . '>';
                foreach ($this->arrViewModeFields as $key => $val) {
                    if (isset($val['align']) && $val['align'] == 'left' && Application::Get('defined_left') == 'right') {
                        $align = ' align="right"';
                    } else {
                        if (isset($val['align']) && $val['align'] == 'right' && Application::Get('defined_right') == 'left') {
                            $align = ' align="left"';
                        } else {
                            if (isset($val['align'])) {
                                $align = ' align="' . $val['align'] . '"';
                            } else {
                                $align = '';
                            }
                        }
                    }
                    $wrap = isset($val['nowrap']) && $val['nowrap'] == 'nowrap' ? ' nowrap="' . $val['nowrap'] . '"' : ' wrap';
                    $visible = isset($val['visible']) && $val['visible'] !== '' ? $val['visible'] : true;
                    $movable = isset($val['movable']) && $val['movable'] !== '' ? $val['movable'] : false;
                    if (isset($arrRecords[0][$i][$key])) {
                        $field_value = $this->DrawFieldByType('view', $key, $val, $arrRecords[0][$i], false);
                        if ($this->isAggregateAllowed && isset($this->arrAggregateFields[$key])) {
                            $key_agreg = isset($this->arrAggregateFields[$key]['aggregate_by']) && $this->arrAggregateFields[$key]['aggregate_by'] !== '' ? $this->arrAggregateFields[$key]['aggregate_by'] : $key;
                            if (!isset($this->arrAggregateFieldsTemp[$key])) {
                                $this->arrAggregateFieldsTemp[$key] = array('sum' => $arrRecords[0][$i][$key_agreg], 'count' => 1);
                            } else {
                                $this->arrAggregateFieldsTemp[$key]['sum'] += $arrRecords[0][$i][$key_agreg];
                                $this->arrAggregateFieldsTemp[$key]['count']++;
                            }
                        }
                    } else {
                        if ($this->debug) {
                            $this->arrWarnings['wrong_' . $key] = 'Field <b>' . $key . '</b>: wrong definition in View mode or at least one field has no value in SQL! Please check currefully your code.';
                        }
                        $field_value = '';
                    }
                    if ($visible) {
                        $move_link = '';
                        if ($movable) {
                            $move_prev_id = $arrRecords[0][$i]['id'] . '-' . (isset($arrRecords[0][$i - 1]['id']) ? $arrRecords[0][$i - 1]['id'] : '') . '#';
                            $move_prev_id .= $key . '#';
                            $move_prev_id .= $arrRecords[0][$i][$key] . '-' . (isset($arrRecords[0][$i - 1][$key]) ? $arrRecords[0][$i - 1][$key] : '');
                            $move_next_id = $arrRecords[0][$i]['id'] . '-' . (isset($arrRecords[0][$i + 1]['id']) ? $arrRecords[0][$i + 1]['id'] : '') . '#';
                            $move_next_id .= $key . '#';
                            $move_next_id .= $arrRecords[0][$i][$key] . '-' . (isset($arrRecords[0][$i + 1][$key]) ? $arrRecords[0][$i + 1][$key] : '');
                            if (isset($arrRecords[0][$i - 1]['id'])) {
                                $move_link .= ' <a href="javascript:void(\'move|up\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'' . $arrRecords[0][$i]['id'] . '\', \'\', \'\', \'\', \'move\', \'up\', \'' . $move_prev_id . '\')">';
                                $move_link .= $this->actionIcons ? '<img src="images/microgrid_icons/up.png" style="margin-bottom:2px" alt="" title="' . _UP . '">' : _UP;
                                $move_link .= '</a>';
                            } else {
                                $move_link .= ' <span style="width:11px;height:11px;"></span>';
                            }
                            if (isset($arrRecords[0][$i + 1]['id'])) {
                                $move_link .= '<a href="javascript:void(\'move|down\');" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'' . $arrRecords[0][$i]['id'] . '\', \'\', \'\', \'\', \'move\', \'down\', \'' . $move_next_id . '\')">';
                                $move_link .= $this->actionIcons ? '<img src="images/microgrid_icons/down.png" style="margin-top:2px" alt="" title="' . _DOWN . '">' : (isset($arrRecords[0][$i - 1]['id']) ? '/' : '') . _DOWN;
                                $move_link .= '</a>';
                            } else {
                                $move_link .= '<span style="width:11px;height:11px;"></span>';
                            }
                        }
                        echo '<td' . $align . $wrap . '>' . $field_value . $move_link . '</td>';
                        if ($operation == 'switch_to_export' && strtolower(SITE_MODE) != 'demo') {
                            $export_content[$i + 1][] = str_replace(',', '', strip_tags($field_value));
                        }
                    }
                }
                if ($this->actions['details'] || $this->actions['edit'] || $this->actions['delete']) {
                    echo '<td align="center" nowrap="nowrap">';
                    if ($this->actions['details']) {
                        echo '<a href="javascript:void(\'details|' . $arrRecords[0][$i][$this->primaryKey] . '\');" title="' . _VIEW_WORD . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'details\', \'' . $arrRecords[0][$i]['id'] . '\')">' . ($this->actionIcons ? '<img src="images/microgrid_icons/details.gif" title="' . _VIEW_WORD . '" alt="" border="0" style="margin:0px; padding:0px;" height="16px">' : _VIEW_WORD) . '</a>';
                    }
                    if ($this->actions['edit']) {
                        if ($this->actions['details']) {
                            echo '&nbsp;' . ($this->actionIcons ? '&nbsp;' : '') . draw_divider(false) . '&nbsp';
                        }
                        echo '<a href="javascript:void(\'edit|' . $arrRecords[0][$i][$this->primaryKey] . '\')" title="' . _EDIT_WORD . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'edit\', \'' . $arrRecords[0][$i]['id'] . '\')">' . ($this->actionIcons ? '<img src="images/microgrid_icons/edit.gif" title="' . _EDIT_WORD . '" alt="" border="0" style="margin:0px;padding:0px;" height="16px">' : _EDIT_WORD) . '</a>';
                    }
                    if ($this->actions['delete']) {
                        if ($this->actions['edit'] || $this->actions['details']) {
                            echo '&nbsp;' . ($this->actionIcons ? '&nbsp;' : '') . draw_divider(false) . '&nbsp';
                        }
                        echo '<a href="javascript:void(\'delete|' . $arrRecords[0][$i][$this->primaryKey] . '\')" title="' . _DELETE_WORD . '" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'delete\', \'' . $arrRecords[0][$i]['id'] . '\')">' . ($this->actionIcons ? '<img src="images/microgrid_icons/delete.gif" title="' . _DELETE_WORD . '" alt="" border="0" style="margin:0px;padding:0px;" height="16px">' : _DELETE_WORD) . '</a>';
                    }
                    echo '&nbsp;</td>';
                }
                echo '</tr>';
            }
            // for
            // draw aggregate fields row
            if ($this->isAggregateAllowed) {
                echo '<tr><td colspan="' . $colspan . '" height="5px" nowrap="nowrap">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
                echo '<tr>';
                foreach ($this->arrViewModeFields as $key => $val) {
                    $visible = isset($val['visible']) && $val['visible'] !== '' ? $val['visible'] : true;
                    if ($visible) {
                        $ag_field_total = isset($this->arrAggregateFieldsTemp[$key]) ? $this->arrAggregateFieldsTemp[$key]['sum'] : 0;
                        $ag_field_count = isset($this->arrAggregateFieldsTemp[$key]) ? $this->arrAggregateFieldsTemp[$key]['count'] : 0;
                        $ag_field_function = strtoupper(isset($this->arrAggregateFields[$key]['function']) ? $this->arrAggregateFields[$key]['function'] : '');
                        $ag_field_align = strtoupper(isset($this->arrAggregateFields[$key]['align']) ? $this->arrAggregateFields[$key]['align'] : 'center');
                        $ag_decimal_place = isset($this->arrAggregateFields[$key]['decimal_place']) ? (int) $this->arrAggregateFields[$key]['decimal_place'] : 2;
                        $ag_field_value = '';
                        if ($ag_field_function == 'SUM') {
                            $ag_field_value = $ag_field_count != 0 ? number_format($ag_field_total, $ag_decimal_place) : '';
                        } else {
                            if ($ag_field_function == 'AVG') {
                                $ag_field_value = $ag_field_count != 0 ? number_format($ag_field_total / $ag_field_count, $ag_decimal_place) : '';
                            }
                        }
                        echo '<td align="' . $ag_field_align . '">' . ($ag_field_function != '' ? $ag_field_function . '=' : '') . $ag_field_value . '</td>';
                    }
                }
                echo '</tr>';
                echo '<tr><td colspan="' . $colspan . '" height="5px" nowrap="nowrap">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            } else {
                echo '<tr><td colspan="' . $colspan . '" height="15px" nowrap="nowrap">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            }
            echo '</table>';
            echo '<table width="100%" border="0" cellspacing="0" cellpadding="2" class="mgrid_table">';
            echo '<tr valign="top">';
            echo '<td>';
            if ($this->isPagingAllowed) {
                echo '<b>' . _PAGES . ':</b> ';
                for ($i = 1; $i <= $total_pages; $i++) {
                    echo '<a class="paging_link" href="javascript:void(\'paging\')" onclick="javascript:__mgDoPostBack(\'' . $this->tableName . '\', \'view\', \'\', \'\', \'\', \'' . $i . '\', \'\')">' . ($i == $page ? '<b>[' . $i . ']</b>' : $i) . '</a> ';
                }
            }
            echo '</td>';
            echo '<td align="' . Application::Get('defined_right') . '">';
            $row_from = $start_row + 1;
            $row_to = $start_row + $this->pageSize < $total_records ? $start_row + $this->pageSize : $total_records;
            echo '<b>' . _TOTAL . '</b>: ' . ($row_from < $row_to ? $row_from . ' - ' . $row_to : $row_from) . ' / ' . $total_records;
            echo '</td>';
            echo '</tr>';
            echo '</table>';
            // prepare export file
            //----------------------------------------------------------------------
            if ($operation == 'switch_to_export') {
                if (strtolower(SITE_MODE) == 'demo') {
                    $this->error = _OPERATION_BLOCKED;
                } else {
                    $export_content_count = count($export_content);
                    $fe = @fopen('tmp/export/export.csv', 'w+');
                    @fwrite($fe, "");
                    for ($i = 0; $i < $export_content_count; $i++) {
                        @fputcsv($fe, $export_content[$i]);
                    }
                    @fclose($fe);
                }
            }
        } else {
            draw_message(_NO_RECORDS_FOUND, true, true, false, 'width:100%');
            //if($this->debug) $this->arrSQLs['select'] = $this->VIEW_MODE_SQL.' '.$this->WHERE_CLAUSE.' '.$this->ORDER_CLAUSE.' LIMIT '.$start_row.', '.(int)$this->pageSize;
        }
        echo '</form>';
        $this->CalendarSetupFields($calendar_fields);
        $this->AfterViewRecords();
        $this->DrawVersionInfo();
        $this->DrawRunningTime();
        $this->DrawErrors();
        $this->DrawWarnings();
        $this->DrawSQLs();
        $this->DrawPostInfo();
    }
示例#5
0
    $rel = 'Male' === FieldNames::value('sex', $member->sex) ? 'son' : 'daughter';
    $rel_name = $member->family->head_name;
} elseif ('Female' == FieldNames::value('sex', $member->sex)) {
    $rel = 'wife';
    $husband = $member->family->husband;
    $rel_name = $husband->fullname();
}
if (isset($rel)) {
    $pdf->Cell(0, 1, "    This is to certify that " . sprintf("%-40s", $member->fname . " " . $member->lname) . ", {$rel} of", 0, 1, 'L');
    $pdf->Cell(2, 0, '', 0, 0);
    $pdf->Cell(0, 1, "    of " . sprintf("%-40s", $rel_name) . " belongs to my Parish and", 0, 1, 'L');
    draw_line($pdf, 11);
    $pdf->Cell(2, 0, '', 0, 0);
    $pdf->Cell(0, 0, "    is regular to Church services.", 0, 1, 'L');
    draw_line($pdf, 12, 4.3, 11.6);
} else {
    $pdf->Cell(0, 1, "    This is to certify that " . sprintf("%-40s", $member->fname . " " . $member->lname) . "", 0, 1, 'L');
    draw_line($pdf, 11);
    $pdf->Cell(2, 0, '', 0, 0);
    $pdf->Cell(0, 1, "    belongs to my Parish and is regular to Church services.", 0, 1, 'L');
    $pdf->Cell(0, 0.7, '', 0, 1);
}
$pdf->Cell(0, 4, '', 0, 1);
$pdf->Cell(3, 0, '', 0, 0);
$pdf->SetFont("courier", "I", 11);
draw_line($pdf, 17.6, 11.3, 17.3);
$pdf->Cell(0, 1, 'Date: ' . $model->cert_dt, 0, 1, 'L');
$pdf->Cell(0, 0, 'Parish Priest or Assistant            ', 0, 0, 'R');
$id = $member->id;
$pdf->Output("membership-cert-{$id}.pdf", "I");
Yii::app()->end();
示例#6
0
function show_field($pdf, $label, $value)
{
    $pdf->Cell(4, 0, "", 0, 0);
    $pdf->Cell(0, 0.8, sprintf("%-20s: %s", strtoupper($label), strtoupper($value)), 0, 1, 'L');
    draw_line($pdf);
}
示例#7
0
</th>
			<th width="15%" nowrap="nowrap"><?php 
        echo _CONTENT_TYPE;
        ?>
</th>
			<?php 
        if ($objLogin->HasPrivileges('edit_pages') || $objLogin->HasPrivileges('delete_pages')) {
            echo '<th width="13%">' . _ACTIONS_WORD . '</th>';
        } else {
            echo '<th></th>';
        }
        ?>
			
		</tr>
		<tr><td colspan="6" height="3px" nowrap="nowrap"><?php 
        draw_line();
        ?>
</td></tr>
		<?php 
        for ($i = 0; $i < $all_pages[1]; $i++) {
            // prepare page header for display
            $page_header = $all_pages[0][$i]['page_title'];
            if (strlen($page_header) > 60) {
                $page_header = substr($page_header, 0, 60) . '..';
            }
            // prepare menu link for display
            $menu_name = $all_pages[0][$i]['menu_name'];
            if (strlen($menu_name) > 18) {
                $menu_name = substr($menu_name, 0, 18) . '..';
            }
            // display page row
示例#8
0
    /**
     * Draws listings in category
     * 		@param $category_id
     * 		@param $draw
     */
    public function DrawListings($category_id, $draw = true)
    {
        global $objLogin, $objSettings;
        $lang = Application::Get('lang');
        $nl = "\n";
        if (empty($lang)) {
            $lang = Languages::GetDefaultLang();
        }
        $listings_locations = isset($_REQUEST['listings_locations']) ? prepare_input($_REQUEST['listings_locations']) : '';
        $listings_sub_locations = isset($_REQUEST['listings_sub_locations']) ? prepare_input($_REQUEST['listings_sub_locations']) : '';
        $listings_sort_by = isset($_REQUEST['listings_sort_by']) && $_REQUEST['listings_sort_by'] != '' ? prepare_input($_REQUEST['listings_sort_by']) : 'rating';
        $listings_order_by = isset($_REQUEST['listings_order_by']) && $_REQUEST['listings_order_by'] != '' ? prepare_input($_REQUEST['listings_order_by']) : 'ASC';
        $sort_by = '';
        $order_by = '';
        $output = '';
        if ($listings_sort_by == 'name') {
            $sort_by = 'ld.business_name';
            $order_by = $listings_order_by;
        } else {
            if ($listings_sort_by == 'date') {
                $sort_by = 'l.date_published';
                $order_by = $listings_order_by;
            } else {
                if ($listings_sort_by == 'rating') {
                    // rating according to advertising plans high rate = high advertising plan
                    $sort_by = 'l.advertise_plan_id';
                    $order_by = ($listings_order_by == 'ASC' ? 'DESC' : 'ASC') . ', RAND()';
                } else {
                    $sort_by = 'l.priority_order';
                    $order_by = $listings_order_by;
                }
            }
        }
        if (!Application::Get('js_included', 'lytebox')) {
            $output .= '<!-- LyteBox v3.22 Author: Markus F. Hay Website: http://www.dolem.com/lytebox -->' . $nl;
            $output .= '<link rel="stylesheet" href="modules/lytebox/css/lytebox.css" type="text/css" media="screen" />' . $nl;
            $output .= '<script type="text/javascript" src="modules/lytebox/js/lytebox.js"></script>' . $nl;
        }
        // draw category description
        $category_info = Categories::GetCategoryInfo($category_id);
        if ($category_info['description'] != '') {
            $output .= draw_message($category_info['description'], false);
        }
        // draw result
        $sql_from = TABLE_LISTINGS . ' l 
					INNER JOIN ' . TABLE_LISTINGS_DESCRIPTION . ' ld ON l.id = ld.listing_id
					INNER JOIN ' . TABLE_LISTINGS_LOCATIONS . ' ll ON l.listing_location_id = ll.id
				WHERE
					' . (!empty($listings_locations) ? 'l.listing_location_id = \'' . $listings_locations . '\' AND ' : '') . '
					' . (!empty($listings_sub_locations) ? 'l.listing_sub_location_id = \'' . $listings_sub_locations . '\' AND ' : '') . '
					' . (!$objLogin->IsLoggedIn() ? 'l.access_level=\'public\' AND ' : '') . '
					l.is_published = 1 AND
					' . ($this->show_expired_listings != 'yes' ? ' ((l.finish_publishing = \'0000-00-00 00:00:00\') OR (l.finish_publishing > \'' . date('Y-m-d H:i:s') . '\')) AND ' : '') . '
					ld.language_id = \'' . $lang . '\'
					' . ($category_id != '' ? ' AND l.id IN (SELECT listing_id FROM ' . TABLE_LISTINGS_CATEGORIES . ' lc WHERE category_id = ' . (int) $category_id . ')' : '') . '
				ORDER BY ' . $sort_by . ' ' . $order_by;
        // pagination prepare
        $page_size = ModulesSettings::Get('listings', 'listings_per_page');
        $start_row = '0';
        $total_pages = '1';
        pagination_prepare($page_size, $sql_from, $start_row, $total_pages);
        $sql = 'SELECT l.id,
					l.image_file,
					l.image_file_thumb,
					l.priority_order,
					l.date_published,
					l.website_url,
					l.business_email,
					l.advertise_plan_id,
					ll.name as listing_location_name,
					ld.language_id,					
					ld.business_name,
					ld.business_address,
					ld.business_description
				FROM ' . $sql_from . '
				LIMIT ' . $start_row . ', ' . $page_size;
        $result = database_query($sql, DATA_AND_ROWS, ALL_ROWS);
        if ($result[1] > 0 || !empty($listings_locations)) {
            $output .= '<form id="frmCategoryView" action="index.php?page=category&cid=' . $category_id . '" method="post">';
            $output .= draw_token_field(false);
            $output .= draw_hidden_field('p', '1', false);
            $output .= '<table width="98%" border="0" align="center">';
            $output .= '<tr><th colspan="3" nowrap="nowrap" height="5px"></th></tr>';
            $output .= '<tr><th colspan="2" align="' . Application::Get('defined_left') . '" valign="middle">';
            $output .= '&nbsp;' . _FILTER_BY . ': ';
            $output .= ListingsLocations::DrawAllLocations(array('tag_name' => 'listings_locations', 'selected_value' => $listings_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false) . ' &nbsp;';
            $output .= ListingsSubLocations::DrawAllSubLocations($listings_locations, array('tag_name' => 'listings_sub_locations', 'selected_value' => $listings_sub_locations, 'javascript_event' => 'onchange="jQuery(\'#frmCategoryView\').submit();"'), false);
            $output .= '</th>';
            $output .= '<th colspan="2" align="' . Application::Get('defined_right') . '" valign="middle">';
            $output .= _SORT_BY . ': 
					<select name="listings_sort_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="rating" ' . ($listings_sort_by == 'rating' ? ' selected="selected"' : '') . '>' . _RATING . '</option>
						<option value="name" ' . ($listings_sort_by == 'name' ? ' selected="selected"' : '') . '>' . _NAME . '</option>
						<option value="date" ' . ($listings_sort_by == 'date' ? ' selected="selected"' : '') . '>' . _DATE_PUBLISHED . '</option>
					</select>&nbsp;
					<select name="listings_order_by" onchange="jQuery(\'#frmCategoryView\').submit();">
						<option value="ASC" ' . ($listings_order_by == 'ASC' ? ' selected="selected"' : '') . '>' . _ASCENDING . '</option>
						<option value="DESC" ' . ($listings_order_by == 'DESC' ? ' selected="selected"' : '') . '>' . _DESCENDING . '</option>
					</select>
					</th>
				</tr>
			</table>
			</form>';
        }
        if ($result[1] > 0) {
            $output .= '<table width="99%" border="0" align="center">';
            $output .= '<tr><th colspan="2" nowrap="nowrap" height="5px"></th></tr>
				<tr>
					<th align="' . Application::Get('defined_left') . '">&nbsp; ' . _LISTINGS . ' &nbsp;</th>
					<th align="center">' . _IMAGE . '</th>
				</tr>';
            for ($i = 0; $i < $result[1]; $i++) {
                $image_file = $result[0][$i]['image_file'] != '' ? $result[0][$i]['image_file'] : 'no_image.png';
                ///$result[0][$i]['advertise_plan_id'] > 1 &&
                $image_file_thumb = $result[0][$i]['image_file_thumb'] != '' ? $result[0][$i]['image_file_thumb'] : 'no_image.png';
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>
					<tr valign="top">
						<td>';
                $link_1 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', $result[0][$i]['business_name'], '', _CLICK_TO_SEE_DESCR);
                $link_2 = prepare_link('listing', 'lid', $result[0][$i]['id'], '', _MORE_INFO, '', _CLICK_TO_SEE_DESCR);
                $output .= '<div class="listing_info">';
                $output .= '<div class="header">' . $link_1 . '</div>';
                $output .= '<div class="address">' . substr_by_word(strip_tags($result[0][$i]['business_address']), 300, true, Application::Get('lang')) . ' ' . $result[0][$i]['listing_location_name'] . '</div>';
                $output .= '<div class="description">' . substr_by_word(strip_tags($result[0][$i]['business_description']), 180, true, Application::Get('lang')) . '</div>';
                $output .= '<div class="links">
											' . $link_2 . '
											' . ($result[0][$i]['website_url'] != '' ? ' : <a href="' . $result[0][$i]['website_url'] . '" target="_new">' . _WEBSITE_URL . '</a>' : '') . '
											' . ($result[0][$i]['business_email'] != '' ? ' : <a href="mailto:' . $result[0][$i]['business_email'] . '">' . _EMAIL . '</a>' : '') . '
											' . ($result[0][$i]['date_published'] != '0000-00-00 00:00:00' ? '<div class="published">' . _PUBLISHED . ': ' . format_datetime($result[0][$i]['date_published'], get_datetime_format(false), _UNKNOWN) . '<div>' : '') . '
										</div>';
                $output .= '</div>';
                $output .= '
						</td>
						<td width="130px" align="center">
							<div class="listing_icon">';
                if ($image_file != 'no_image.png') {
                    $output .= '<a href="images/listings/' . $image_file . '" rel="lyteshow_' . $result[0][$i]['id'] . '">';
                }
                $output .= '<img class="listings_image' . ($image_file == 'no_image.png' ? ' no_hover' : '') . '" src="images/listings/' . $image_file_thumb . '" width="120px" height="90px" title="' . ($image_file != 'no_image.png' ? _CLICK_TO_INCREASE : '') . '" alt="" />';
                if ($image_file != 'no_image.png') {
                    $output .= '</a>';
                }
                $output .= '
							</div>
						</td>
					</tr>';
            }
            // draw pagination links
            if ($total_pages > 1) {
                $output .= '<tr><td colspan="2" style="padding:7px;">' . draw_line('no_margin_line', IMAGE_DIRECTORY, false) . '</td></tr>';
            }
            $output .= '<tr><td colspan="2">';
            $output .= pagination_get_links($total_pages, '');
            $output .= '</td></tr>';
            $output .= '<tr><td colspan="2">&nbsp;</td></tr>';
            $output .= '</table>';
        } else {
            // draw message only if this is a last-level empty category
            $categories = Categories::GetAllActive('c.parent_id = ' . (int) $category_id);
            if (!$categories[1]) {
                $output .= draw_message(_NO_LISTINGS_FOUND, false, true);
            }
        }
        if ($draw) {
            echo $output;
        } else {
            return $output;
        }
    }
示例#9
0
} else {
    $pdf->Cell(0, 19, "", 0, 1);
}
$pdf->SetFont("times", "R", 20);
$pdf->Cell(0, 0, "Remembrance Of First Holy Communion", 0, 1, 'C');
$pdf->SetFont("courier", "I", 11);
$firstCommunion = $model->firstCommunion;
$pdf->Cell(0, 1, '', 0, 1);
$pdf->Cell(4, 0, "", 0, 0);
$count = 0;
function draw_line($pdf, $x1 = 5.0)
{
    global $count;
    $pdf->Line($x1, 22.6 + $count * 0.8, 16, 22.6 + $count * 0.8, array('width' => 0.01, 'dash' => 3));
    ++$count;
}
$pdf->Cell(0, 0.8, $firstCommunion->name, 0, 1, 'L');
draw_line($pdf);
$pdf->Cell(4, 0, "", 0, 0);
$pdf->Cell(0, 0.8, "received First Holy Communion on " . $firstCommunion->communion_dt, 0, 1, 'L');
draw_line($pdf, 12.7);
$pdf->Cell(4, 0, "", 0, 0);
$pdf->Cell(0, 0.8, "in " . $parish->name, 0, 1, 'L');
draw_line($pdf, 5.7);
$pdf->Cell(0, 1, '', 0, 1);
#	$pdf->Cell(10,1,'DATE: '.$model->cert_dt,0,1,'C');
$pdf->Line(8, 25.8, 12, 25.8, array('width' => 0.01, 'dash' => 3));
$pdf->Cell(0, 0, 'P. Priest/Pastor                 ', 0, 0, 'R');
$id = $model->id;
$pdf->Output("first-communion-cert-{$id}.pdf", "I");
Yii::app()->end();
示例#10
0
        } else {
            switch ($ldig) {
                case 1:
                    return strval($dt) . "st";
                case 2:
                    return strval($dt) . "nd";
                case 3:
                    return strval($dt) . "rd";
            }
        }
    }
}
$pdf->Cell(0, 0, "on the " . th($dd) . " day of {$month}", 0, 1, 'L');
$pdf->Cell(0, 1, '', 0, 1);
$pdf->Cell(9, 0, '', 0, 0);
$pdf->SetFont("times", "R", 18);
$pdf->Cell(0, 0, $yr, 0, 1, 'L');
$pdf->Cell(0, 1, '', 0, 1);
$pdf->Cell(8, 0, '', 0, 0);
$pdf->Cell(0, 0, "in the Church of", 0, 1, 'L');
$pdf->Cell(0, 1, '', 0, 1);
$pdf->Cell(8, 0, '', 0, 0);
$pdf->Cell(0, 0.8, $confirmation->church, 0, 1, 'L');
draw_line($pdf, 22);
draw_line($pdf, 23);
$pdf->Cell(0, 4, '', 0, 1);
draw_line($pdf, 25.5);
$pdf->Cell(0, 0, 'Bishop                                              ', 0, 0, 'R');
$id = $model->id;
$pdf->Output("confirmation-cert-{$id}.pdf", "I");
Yii::app()->end();
示例#11
0
    /**
     * Draws vocabulary
     * 		@param $key
     */
    public function DrawVocabulary($key)
    {
        $align_left = Application::Get('lang_dir') == 'ltr' ? 'left' : 'right';
        $align_right = Application::Get('lang_dir') == 'ltr' ? 'right' : 'left';
        $this->GetVocabulary($this->whereClause);
        echo '<a name="top"></a>';
        echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="2" class="main_text">
			  <tr>
				<td>' . _FILTER_BY . ': ';
        echo prepare_permanent_link('index.php?admin=vocabulary' . $this->langIdByUrl, _ALL) . ' - ';
        for ($i = 65; $i < 91; $i++) {
            if ($this->filterBy == chr($i)) {
                $chr_i = '<b><u>' . chr($i) . '</u></b>';
            } else {
                $chr_i = chr($i);
            }
            echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . chr($i) . $this->langIdByUrl, $chr_i) . ' ';
        }
        echo ' - ';
        for ($i = 1; $i <= 5; $i++) {
            if ($this->filterBy == $i) {
                $chr_i = '<b><u>' . $i . '</u></b>';
            } else {
                $chr_i = $i;
            }
            echo prepare_permanent_link('index.php?admin=vocabulary&filter_by=' . $i . $this->langIdByUrl, $chr_i) . ' ';
        }
        echo '</td>
				<td width="7%" align="center" nowrap="nowrap">
				' . _TOTAL . ': ' . count($this->keys) . '
				</td>
			  </tr>';
        echo '<tr align="center"><td colspan="2">' . draw_line('line_no_margin', IMAGE_DIRECTORY, false) . '</td></tr>';
        echo '</table>';
        if (!empty($this->keys)) {
            echo '<table width="100%" align="center" border="0" cellspacing="0" cellpadding="3" class="main_text">';
            echo '<tr>
					<th width="1%">#</th>
					<th width="25%" align="' . $align_left . '">' . _KEY . '</th>
					<th width="65%" align="' . $align_left . '">' . _VALUE . '</th>
					<th width="9%"></th>';
            for ($i = 0; $i < $this->vocabularySize; $i++) {
                // Prepare key_text for displaying
                $decoded_text = strip_tags(decode_text($this->keys[$i]['key_text']));
                if (strlen($decoded_text) > 90) {
                    $key_text = '<span style="cursor:help;" title="' . $decoded_text . '">' . substr_by_word($decoded_text, 95, true) . '</span>';
                } else {
                    $key_text = $decoded_text;
                }
                // Display vocabulary row
                if ($this->keys[$i]['key_value'] == $this->currentKey) {
                    echo '<tr>';
                    echo '<td align="' . $align_right . '" class="voc_row_edit_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                    echo '<td align="' . $align_left . '" class="voc_row_edit_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                    echo '<td align="' . $align_left . '" class="voc_row_edit_middle">' . $key_text . '</td>
					      <td align="center" class="voc_row_edit_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                } else {
                    if ($this->keys[$i]['id'] == (int) $key) {
                        echo '<tr>';
                        echo '<td align="' . $align_right . '" class="voc_row_update_' . $align_left . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                        echo '<td align="' . $align_left . '" class="voc_row_update_middle" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                        echo '<td align="' . $align_left . '" class="voc_row_update_middle">' . $key_text . '</td>
					      <td align="center" class="voc_row_update_' . $align_right . '">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                    } else {
                        echo '<tr ' . highlight(0) . ' onmouseover="oldColor=this.style.backgroundColor;this.style.backgroundColor=\'#ededed\';" onmouseout="this.style.backgroundColor=oldColor">';
                        echo '<td align="' . $align_right . '" nowrap="nowrap">' . ($i + 1) . '.</td>';
                        echo '<td align="' . $align_left . '" nowrap="nowrap">' . $this->keys[$i]['key_value'] . '</td>';
                        echo '<td align="' . $align_left . '">' . $key_text . '</td>
					      <td align="center">' . prepare_permanent_link('index.php?admin=vocabulary&key=' . $this->keys[$i]['id'] . '&act=edit' . $this->filterByUrl . $this->langIdByUrl, '[ ' . _EDIT_WORD . ' ]') . '</td>
					</tr>';
                    }
                }
            }
            echo '<tr><td colspan="4" nowrap="nowrap" height="10px"></td></tr>';
            if ($this->vocabularySize > 15) {
                echo '<tr valign="bottom"><td colspan="3"></td><td align="center">' . prepare_permanent_link('index.php?admin=vocabulary' . $this->filterByUrl . $this->langIdByUrl . '#top', _TOP . ' ^') . '</td></tr>';
            }
            echo '</table>';
        } else {
            draw_important_message(_VOC_NOT_FOUND);
        }
    }
function draw_grid($width, $height, $min_x, $min_y, $max_x, $max_y, $x0, $y0, $dx, $dy, $low_color, $high_color)
{
    // x-grid
    echo "c.save();\n";
    echo "c.strokeStyle = '" . $high_color . "';\n";
    echo "c.lineWidth = 1;\n";
    echo "c.fillStyle ='#000000';\n";
    echo "c.font = '10px Monotype';\n";
    echo "c.beginPath();\n";
    $x_step = grid_delta_x($min_x, $max_x, $width);
    for ($x = $min_x; $x <= $max_x; $x += $x_step) {
        draw_line($x, 0, $x, $dy, $min_x, $dx, $dy, $height);
        if ($x == $min_x || $max_x < $x + $x_step || floor(($x - $x_step) / (3600 * 1000)) != floor($x / (3600 * 1000))) {
            echo "c.fillText('" . date("H:i", $x / 1000) . "', " . floor(($x - $min_x) / $dx - 13) . ", " . ($height + 10) . ");\n";
        } else {
            echo "c.fillText('" . date("  :i", $x / 1000) . "', " . floor(($x - $min_x) / $dx - 13) . ", " . ($height + 10) . ");\n";
        }
        if ($x == $min_x || $max_x < $x + $x_step || floor(($x - $x_step) / (24 * 3600 * 1000)) != floor($x / (24 * 3600 * 1000))) {
            echo "c.fillText('" . date("m-d", $x / 1000) . "', " . floor(($x - $min_x) / $dx - 13) . ", " . ($height + 20) . ");\n";
        }
    }
    // y-grid
    $y = $min_y;
    $digit = (int) ($max_y / pow(10, floor(log10($max_y - $min_y))) + 0.5);
    $high_mod = 2;
    if ($digit == 1) {
        $digit = 10;
    } else {
        if ($digit == 2) {
            $high_mod = 5;
            $digit = 10;
        } else {
            if ($digit == 3) {
                $digit = 6;
            }
        }
    }
    $delta = ($max_y - $min_y) / $digit;
    if ($delta <= 0) {
        $delta = 1;
    }
    $i = 1;
    for ($y = $min_y + $delta; $y < $max_y; $y += $delta) {
        $yp = $y0 + ($y - $min_y) * $height / ($max_y - $min_y);
        $color = $i % $high_mod == 0 ? $high_color : $low_color;
        $i++;
    }
    echo "c.restore();\n";
}
示例#13
0
 /**
  * Draws search result
  *		@param $search_result - search result
  *		@param $page
  *		@param $keyword
  *		@param $type
  */
 public function DrawSearchResult($search_result, $page = 1, $keyword = '', $type = 'quick')
 {
     $total_pages = (int) ($this->totalSearchRecords / $this->pageSize);
     if (!is_numeric($total_pages) || (int) $total_pages <= 0) {
         $total_pages = 1;
     }
     if ($search_result != '' && $search_result[1] > 0) {
         echo '<div class="pages_contents">';
         for ($i = 0; $i < $search_result[1]; $i++) {
             if ($search_result[0][$i]['content_type'] == 'article') {
                 echo $i + 1 . '. ' . prepare_permanent_link('index.php?' . $search_result[0][$i]['url'], decode_text($search_result[0][$i]['title'])) . '<br />';
                 if (isset($search_result[0][$i]['image_file_thumb'])) {
                     echo '<img src="images/listings/' . $search_result[0][$i]['image_file_thumb'] . '" style="width:42px;height:42px;margin:4px;" align="' . Application::Get('defined_left') . '" alt="" />';
                 }
                 $page_text = $search_result[0][$i]['text'];
                 $page_text = str_replace(array('\\r', '\\n'), '', $page_text);
                 $page_text = preg_replace('/{module:(.*?)}/i', '', $page_text);
                 $page_text = strip_tags($page_text);
                 $page_text = decode_text($page_text);
                 if (!empty($keyword)) {
                     $page_text = $this->HighLight($page_text, array($keyword));
                 }
                 echo substr_by_word($page_text, 512) . '...<br />';
             } else {
                 echo $i + 1 . '. <a href="' . $search_result[0][$i]['link_url'] . '">' . decode_text($search_result[0][$i]['title']) . '</a> <img src="images/external_link.gif" alt="" /><br />';
             }
             echo '<br />';
             draw_line();
             echo '<br />';
         }
         echo '<b>' . _PAGES . ':</b> ';
         for ($i = 1; $i <= $total_pages; $i++) {
             echo '<a class="paging_link" href="javascript:void(0);" onclick="javascript:appPerformSearch(' . $i . ', \'' . ($type == 'advanced' ? 'frmAdvSearch' : 'frmQuickSearch') . '\');">' . ($i == $page ? '<b>[' . $i . ']</b>' : $i) . '</a> ';
         }
         echo '</div>';
     } else {
         draw_important_message(_NO_RECORDS_FOUND);
     }
 }
示例#14
0
        ?>
:</td>
                        <td colspan="2">
                            <input class="form_text" name="finish_publishing" id="frmPage_finish_publishing" value="<?php 
        echo format_datetime($objPage->GetParameter('finish_publishing'), 'Y-m-d', _NEVER);
        ?>
" size="8" maxlength="10" />
							<img id="finish_publishing_icon" class="calendar_icon" src="images/cal.gif" alt="" />
                        </td>
                    </tr>
				<?php 
    }
    ?>
								
				<tr><td colspan="3" style="padding:5px 0"><?php 
    echo draw_line();
    ?>
</td></tr>
				<tr valign="top">
					<td><?php 
    echo _NOTICE_MODULES_CODE;
    ?>
</td>
					<td colspan="2">
						{module:gallery}<br>
						{module:album=CODE}<br>
						{module:album=CODE:closed}<br>
						{module:contact_us}<br>
						{module:faq}
					</td>
				</tr>