コード例 #1
0
ファイル: cmt_accounts.php プロジェクト: entire-media/comator
$formdata['c_q_first_name'] = array('type' => 'checkbox', 'parent_class' => 'multi_checkbox', 'settings' => array('data' => array('1' => v('CMT_FIRST_NAME'))), 'value' => 1);
$formdata['c_q_last_name'] = array('type' => 'checkbox', 'parent_class' => 'multi_checkbox', 'settings' => array('data' => array('1' => v('CMT_LAST_NAME'))), 'value' => 1);
$formdata['c_q_email'] = array('type' => 'checkbox', 'parent_class' => 'multi_checkbox', 'settings' => array('data' => array('1' => v('CMT_EMAIL'))), 'value' => 1);
foreach ($formdata as $key => $val) {
    if (isset(${$key})) {
        $formdata[$key]['value'] = ${$key};
    }
}
$filter_array['SEARCH'] = $formdata;
$formdata = NULL;
print "<div class='filter'>";
show_filter($filter_array);
print "</div><!-- /.filter -->";
$head_array['TABLE'] = array("CMT_DATE" => "date", "CMT_USERNAME" => "username", "CMT_FIRST_NAME" => "first_name", "CMT_LAST_NAME" => "last_name");
$head_array['CONSTRUCT'] = array("add" => true);
$data_array['TABLE'] = array("date" => "date", "username" => "default", "first_name" => "default", "last_name" => "default");
$data_array['CONSTRUCT'] = array("edit" => true, "copy" => true, "delete" => true, "activate" => true);
if (!isset($order)) {
    $data_array['SORT'] = array("date" => $direction);
} else {
    $data_array['SORT'] = array($order => $direction);
}
foreach ($head_array['CONSTRUCT'] as $key => $value) {
    if ($value === true) {
        print "<div class='engine-function'><a href='#' class='" . $key . "' data-content='" . $modul . "' ><i class='icon-" . $key . "'></i></a></div><!-- /.engine-function -->";
    }
}
print "<div class='table'>";
thead($head_array);
tbody($data_array);
print "</div><!-- /.table -->";
コード例 #2
0
ファイル: Cody.php プロジェクト: richardkeep/tina4stack
    /**
     * An easy way to make a paginated bootStrapTable
     *
     * @param String $sql
     * @param Array $buttons
     * @param String $hideColumns
     * @param String $toolbar
     * @param Integer $rowLimit
     * @param Integer $selected_page
     * @param Array $customFields
     * @param String $name
     * @param String $class
     * @param Boolean $paginate
     * @param Boolean $searchable
     * @param Boolean $checked
     * @param String $checkPostURL
     * @return type
     */
    function bootStrapTable($sql = "select * from user_detail", $buttons = "", $hideColumns = "", $toolbar = "My Grid", $customFields = null, $name = "grid", $tableInfo = "", $formHideFields = "", $class = "table table-striped", $rowLimit = 10, $paginate = true, $searchable = true, $checked = false, $selected_page = 1, $checkedPostURL = "", $checkSingleSelect = true, $event = "", $mobiletooltip = "")
    {
        $DEB = $this->DEB;
        $hideColumns = explode(",", strtoupper($hideColumns));
        $object = rawurlencode(json_encode(func_get_args()));
        $paginating = "false";
        if ($paginate) {
            $paginating = "true";
        }
        $options = ["id" => $name, "class" => $class, "data-toolbar" => "#toolbar" . $name, "data-pagination" => "{$paginating}", "data-side-pagination" => "server", "data-search" => "false", "data-height" => "400", "data-page-list" => "[5, 10, 20, 50, 100, 200]", "data-page-size" => $rowLimit];
        if ($searchable) {
            $options["data-search"] = "true";
        }
        if ($checked) {
            $options["data-click-to-select"] = "true";
            if ($checkSingleSelect) {
                $options["data-single-select"] = "true";
            }
        }
        $data = @$DEB->getRow("select first 1 * from ({$sql}) t ");
        $fieldInfo = @$DEB->fieldinfo;
        if (empty($fieldInfo)) {
            die("Perhaps the SQL for this query is broken {$sql} or the table does not exist, have you specified the correct database in your Cody initialization, Try running migrations with maggy");
        }
        $header = "";
        if ($checked) {
            $header .= th(["data-field" => "checked" . $name . "[]", "class" => "text-left", "data-checkbox" => "true"], "");
        }
        foreach ($fieldInfo as $fid => $field) {
            if (!in_array(strtoupper($field["name"]), $hideColumns)) {
                if (isset($customFields[$field["name"]])) {
                    $customField = $customFields[$field["name"]];
                    if (empty($customField["type"])) {
                        $customField["type"] = "text";
                    }
                    switch ($customField["type"]) {
                        default:
                            $header .= th(["data-field" => $field["name"], "class" => "text-" . $field["align"], "data-sortable" => "true"], ucwords(str_replace("_", " ", strtolower($field["alias"]))));
                            break;
                        case "checkbox":
                            $header .= th(["data-field" => $field["name"], "class" => "text-" . $field["align"], "data-checkbox" => "true"], "");
                            break;
                        case "hidden":
                            $header .= th(["data-field" => $field["name"], "class" => "hidden"], ucwords(str_replace("_", " ", strtolower($field["alias"]))));
                            break;
                    }
                } else {
                    $header .= th(["data-field" => $field["name"], "class" => "text-" . $field["align"], "data-sortable" => "true"], ucwords(str_replace("_", " ", strtolower($field["alias"]))));
                }
            }
        }
        $addColumn = "";
        if ($buttons) {
            $addColumn .= th(["data-field" => "BUTTONS"], "Options");
        }
        $header = thead(tr($header . $addColumn));
        if (empty($toolbar["caption"])) {
            $toolbar = array();
            $toolbar["caption"] = "";
        }
        $insertButton = $this->bootStrapButton("btnInsert", "Add", "call{$name}Ajax('/cody/form/insert','{$name}Target', {object : a{$name}object, record: null, db: '{$DEB->tag}' })", "btn btn-success pull-left", "", true);
        if (empty($toolbar["buttons"])) {
            $toolbar["buttons"] = "";
        }
        $toolbar["buttons"] = $insertButton . $toolbar["buttons"];
        if (empty($toolbar["filter"])) {
            $toolbar["filter"] = "";
        }
        $tableHeading = "";
        if (!empty($toolbar["caption"])) {
            $tableHeading = h3($toolbar["caption"]) . hr();
        }
        $toolbarButtons = $toolbar["buttons"];
        $toolbarFilters = $toolbar["filter"];
        if ($searchable) {
            $toolbarFilters .= div(["class" => "search"], input(["id" => "search{$name}", "class" => "search form-control", "type" => "text", "placeholder" => "Search " . $toolbar["caption"], "onkeyup" => '$table' . $name . '.bootstrapTable(\'getData\')']));
        }
        $toolbarFilters = div(["class" => "form-inline", "role" => "form"], $toolbarFilters);
        $html = $tableHeading . div(["class" => "table-responsive"], div(["class" => "table-toolbar clearfix"], div(["class" => "toolbar-buttons"], $toolbarButtons) . div(["class" => "toolbar-filters"], $toolbarFilters)) . table($options, $header, tbody()));
        $html .= script('
                    var a' . $name . 'object = "' . $object . '";
                    var $table' . $name . ' =  $("#' . $name . '").bootstrapTable({search : false, url : "/cody/data/ajax/' . $this->DEB->tag . '",
                                                                                method : "post",
                                                                                onCheck: function (row) {
                                                                                            eventType = \'check\';
                                                                                           ' . $event . '
                                                                                },
                                                                                onUnCheck: function (row) {
                                                                                           eventType = \'uncheck\';
                                                                                           ' . $event . '
                                                                                },
                                                                                queryParams: function (p) {  return {object: a' . $name . 'object, limit: p.limit, offset :p.offset, order: p.order, search : $("#search' . $name . '").val(), sort: p.sort }

                                                                                } });
                   $search = $("#search' . $name . '");
                    var timeoutId = null;
                    $search.off("keyup").on("keyup", function (event) {
                        clearTimeout(timeoutId);
                        timeoutId = setTimeout(function () {

                          $table' . $name . '.bootstrapTable("refresh", {pageNumber: 1});

                        }, 1000);
                    });

                  ');
        if ($checked) {
            $html = form(["method" => "post", "action" => $checkedPostURL, "enctype" => "multipart/form-data"], $html);
        }
        $html .= div(["id" => "{$name}Target"]);
        $html .= $this->ajaxHandler("", "{$name}Target", "call{$name}Ajax");
        return $html;
    }
コード例 #3
0
ファイル: js_functions.php プロジェクト: entire-media/comator
    $_SESSION['toggle_sidebar'] = $_POST['toggle_sidebar'];
}
if (isset($_POST['toggle_filter'])) {
    $_SESSION['toggle_filter'] = $_POST['toggle_filter'];
}
if (isset($_POST['toggle_val']) && isset($_POST['toggle_type'])) {
    $_SESSION['toggle_filter_' . $_POST['toggle_type']] = $_POST['toggle_val'];
}
if (isset($_GET['update_sort_order'])) {
    $i = 1;
    foreach ($_POST['sort'] as $value) {
        $sql = "UPDATE " . $_SESSION['TABLE_PREFIX'] . $_SESSION['modul'] . " SET sort_order = '" . $i . "' WHERE id = '" . $value . "' ";
        db_mysql_query($sql, $conn);
        $i++;
    }
}
if (isset($_GET['form_inputadd'])) {
    $i = $_GET['form_inputadd'];
    $formdata['source_value_' . $i] = array('type' => 'input_add', 'label' => v('CMT_DATA'), 'class' => 'source_input', 'style' => array('class' => "col-3_of_7"));
    print_form($formdata);
    unset($formdata);
}
if (isset($_POST['sub_page'])) {
    if (isset($_POST['modul'])) {
        $modul = parse($_POST['modul'], 'string');
    }
    if (isset($_POST['sub_page'])) {
        $sub_page = parse($_POST['sub_page'], 'int');
    }
    tbody(unserialize($_POST['params']));
}
コード例 #4
0
ファイル: php.php プロジェクト: sergioflorencio/toucan
 function listar_cad_documento_item($cod_documento)
 {
     /////////////////////////////////////////////////////////////////////////////
     function tbody($codigo_lancamento, $cod_projeto, $cod_ctr_custo, $cod_conta, $historico, $montante, $data_vencimento_liquidacao)
     {
         if (intval($_GET['id']) > 0) {
             $disabled = " disabled ";
         } else {
             $disabled = "  ";
         }
         return "<tr id='rowToClone'>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 20px;padding: 0px 6px;'>\n\t\t\t\t\t\t\t<input " . $disabled . " coluna='codigo_lancamento' id='codigo_lancamento' placeholder='' onchange='calcular_total_debito_credito();' onkeyup='calcular_total_debito_credito();' class='uk-form-small' type='text' style='width: 100%;' value='" . $codigo_lancamento . "'></td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 150px;padding: 0px 6px;'>\n\t\t\t\t\t\t\t<div class='uk-autocomplete uk-form' data-uk-autocomplete='{source:bs_projeto}' style='width: 100%;'>\n\t\t\t\t\t\t\t\t<input " . $disabled . " coluna='cod_projeto' id='cod_projeto' placeholder='' class='uk-form-small' type='text' style='width: 100%;' value='" . $cod_projeto . "'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 150px;padding: 0px 6px;'>\n\t\t\t\t\t\t\t<div class='uk-autocomplete uk-form' data-uk-autocomplete='{source:bs_ctrcusto}' style='width: 100%;'>\n\t\t\t\t\t\t\t\t<input " . $disabled . " coluna='cod_ctr_custo' id='cod_ctr_custo' placeholder='' class='uk-form-small' type='text' style='width: 100%;' value='" . $cod_ctr_custo . "'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 150px;padding: 0px 6px;'>\n\t\t\t\t\t\t\t<div class='uk-autocomplete uk-form' data-uk-autocomplete='{source:bs_conta}' style='width: 100%;'>\n\t\t\t\t\t\t\t\t<input " . $disabled . " coluna='cod_conta' id='cod_conta' placeholder='' class='uk-form-small' type='text' style='width: 100%;' value='" . $cod_conta . "'>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 200px;padding: 0px 5px; '><input " . $disabled . " coluna='historico_' id='historico_' placeholder='' class='uk-form-small' type='text' style='width: 100%;' value='" . $historico . "'></td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 100px;padding: 0px 5px;'><input " . $disabled . " coluna='montante' id='montante' placeholder='' class='uk-form-small' type='text' style='width: 100%;text-align: right;' onchange='formatar_numero(this);calcular_total_debito_credito();' onkeyup='formatar_numero(this);calcular_total_debito_credito();' value='" . $montante . "'></td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 100px;padding: 0px 5px;'><input " . $disabled . " coluna='data_vencimento_liquidacao' id='data_vencimento_liquidacao' placeholder='' class='uk-form-small' type='text' style='width: 100%;' onchange='formatar_data(this);' onkeyup='formatar_data(this);' value='" . $data_vencimento_liquidacao . "'></td>\n\t\t\t\t\t\t<td class='uk-form-row' style='width: 10px;padding: 0px 5px;'>\n\t\t\t\t\t\t\t<button " . $disabled . " class='uk-button uk-button-mini uk-button-danger' type='button' onclick=delRow(this,'tableToModify') data-uk-tooltip title='Excluir linha'><i class='uk-icon-trash-o'></i></button>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>";
     }
     if (intval($_GET['id']) > 0) {
         $tbody = "";
     } else {
         $tbody = tbody('', '', '', '', '', '', '');
     }
     include "config.php";
     $select = "\n\t\t\t\t\tSELECT \n\t\t\t\t\t\t\tcad_documento_item.cod_documento_item, \n\t\t\t\t\t\t\tcad_documento_item.cod_documento, \n\t\t\t\t\t\t\tcad_documento_item.numero_item, \n\t\t\t\t\t\t\tcad_documento_item.codigo_lancamento,\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconcat(cad_projeto.cod_projeto,' - ', cad_projeto.nome_projeto) as cod_projeto,\n\t\t\t\t\t\t\tconcat(cad_conta.numero_conta,' - ', cad_conta.descricao) as cod_conta,\n\t\t\t\t\t\t\tconcat(cad_centro_custo.numero_centro_custo,' - ', cad_centro_custo.descricao) as cod_ctr_custo,\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tmontante, \n\t\t\t\t\t\t\thistorico, \n\n\t\t\t\t\t\t\tDATE_FORMAT(data_vencimento_liquidacao,'%d/%m/%Y') as data_vencimento_liquidacao,\n\t\t\t\t\t\t\tcod_documento_compensacao\n\t\t\t\t\t FROM \n\t\t\t\t\t\t" . $schema_projetos . ".cad_projeto, \n\t\t\t\t\t\t" . $schema . ".cad_documento_item, \n\t\t\t\t\t\t" . $schema . ".cad_conta,\n\t\t\t\t\t\t" . $schema . ".cad_centro_custo \n\t\t\t\t\t\t\n\t\t\t\t\t\twhere \n\t\t\t\t\t\t\tcad_documento_item.cod_projeto=cad_projeto.cod_projeto and\n\t\t\t\t\t\t\tcad_documento_item.cod_conta=cad_conta.cod_conta and\n\t\t\t\t\t\t\tcad_documento_item.cod_ctr_custo=cad_centro_custo.cod_centro_custo and\n\t\t\t\t\t\t\tcod_documento='" . $cod_documento . "'  and cad_documento_item.cod_empresa=" . $_SESSION['cod_empresa'] . " ; ";
     $resultado = mysql_query($select, $conexao) or die(mysql_error());
     while ($row = mysql_fetch_array($resultado)) {
         $tbody .= tbody($row['codigo_lancamento'], $row['cod_projeto'], $row['cod_ctr_custo'], $row['cod_conta'], $row['historico'], $row['montante'], $row['data_vencimento_liquidacao']);
     }
     echo " <div>\n\t\t\t\t\t\t<script>";
     $selects = new selects();
     $selects->projeto_autocomplete('');
     echo "</script>\n\t\t\t\t\t\t<script>";
     $selects = new selects();
     $selects->ctrcusto_autocomplete('');
     echo "</script>\n\t\t\t\t\t\t<script>";
     $selects = new selects();
     $selects->conta_autocomplete('');
     echo "</script>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='uk-form'>\n\t\t\t\t\t\t<table class='uk-table uk-table-hover uk-table-condensed' id='tableToModify'>\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th style='width: 20px;'>CL</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 150px;'>Projeto</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 150px;'>Ctr. Custo</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 150px;'>Conta</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 200px;'>Descrição</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 100px;'>Valor</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 100px;'>Vencimento</th>\n\t\t\t\t\t\t\t\t\t<th style='width: 30px;'></th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t<tbody style='min-height: 250px;'>\n\t\t\t\t\t" . $tbody . "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t</div>\n\t\n\t";
     /////////////////////////////////////////////////////////////////////////////
 }