function GetListTable() { $this->updateOrderItems(); $query = $this->fpdo->from($this->db_table)->where($this->where_str); if ($this->orderBy != '') { $query->orderBy($this->orderBy); } if ($this->limit != '') { $query->limit($this->limit); } if ($this->debug == true) { echo $query->getQuery(); } $count = $query->execute(); $countTable = count($query->execute()); if ($_REQUEST['action'] == "add") { $countTable = 1; } if ($countTable > 0) { if ($this->order == true) { $soratble = "sortable"; $script = "" . " var order_table='{$this->db_table}';\n" . " var order_filed='{$this->f_order}';\n" . " var order_id='{$this->f_id}';\n" . " ordIds=new Array();\n"; } else { $soratble = ""; } if ($_REQUEST['action'] == "_edit") { $linkAction = $_SERVER['PHP_SELF'] . "?action=Edit"; } elseif ($_REQUEST['action'] == "add") { $linkAction = $_SERVER['PHP_SELF'] . "?action=Insert"; } $result .= $this->getParentAttr(); $result .= " <div class='box box-danger'>\n"; $result .= " <div class='box-header with-border'>\n"; $result .= $this->FilterTable(); $result .= " </div>\n"; $result .= " <div class='box-header with-border'>\n"; $result .= $this->getModuleButtons(); $result .= " </div>\n"; $result .= " <div class='box-body'>\n"; $result .= "<form name='TableForm' action='{$linkAction}' method='post'>"; $result .= "<table id='TableForm' class='{$this->class} table table-bordered table-hover' >\n"; $result .= "<thead>\n"; $result .= "<tr>\n"; foreach ($this->columns as $column) { $result .= "<th>"; if ($this->LangEffected[$column] != "") { $lang_org = str_replace($this->LangEffected[$column] . "_", "", $column); $orgin_col = str_replace("_" . $lang_org, "", $column); $result .= $this->getConstant($orgin_col, "") . " (" . $this->getConstant($lang_org) . ")"; } else { $result .= $this->getConstant($column, ""); } $result .= "</th>"; } foreach ($this->extraLinks as $exlink) { $result .= "<th width=30 align='center'>" . $exlink[0] . "</th>\n"; } if ($this->active == true) { $result .= "<th width=30 align='center'>" . active . "</th>\n"; } $i_page = 0; foreach ($query as $row_seo) { if ($i_page < 1) { if ($row_seo[$this->page_id] > 0) { $result .= "<th width=30 align='center'>" . seo . "</th>\n"; $i_page++; } } } $i_dublicate = 0; foreach ($query as $row_dublicate) { if ($i_dublicate < 1) { if ($this->display == true) { $result .= "<th width=30 align='center'>" . dublicate . "</th>\n"; $i_dublicate++; } } } if ($this->special == true) { $result .= "<th width=30 align='center'>" . special . "</th>\n"; } if ($this->static != '') { $result .= "<th width=30 align='center'>" . _static . "</th>\n"; } if ($this->seo == true) { $result .= "<th width=30 align='center'>" . seo . "</th>\n"; } if ($this->widget == true) { $result .= "<th width=30 align='center'>" . widget . "</th>\n"; } if ($this->view_page == true) { $result .= "<th width=30 align='center'>" . view . "</th>\n"; } if ($this->edit != '') { $result .= "<th width=30 align='center'>" . edit . "</th>\n"; } if ($this->delete == true) { $result .= "<th width=30><input type='checkbox' id='SelectAll'></th>\n"; } $result .= "</tr>\n"; $result .= "</thead>\n"; $result .= "<tbody id='{$soratble}' class='sortable ui-sortable'>\n"; $m = 1; if ($_REQUEST['action'] == 'add' && $this->isGridList == true) { if (count($this->types) > 0) { $result .= "<tr>"; $result .= $this->getParametersToPassIt(true); $result .= $this->getParametersToPassIt(); foreach ($this->columns as $col) { $field_ob = new field(); $field_ob->SetIdField($col); $field_ob->SetNameField($col); $field_ob->SetCssClass($this->classes[$col]); $required = $this->requireds[$col]; if ($required == "" && in_array($col, $this->requireds)) { $required = "required"; } $field_ob->SetRequiredField($required); $field_ob->SetValueField($this->source[$col][3]); $field_ob->SetTypeField($this->types[$col]); $field_ob->SetTable($this->extendTables[$col][0]); $field_ob->SetTname($this->extendTables[$col][1]); $field_ob->SetTvalue($this->extendTables[$col][2]); $field_ob->setWhere($this->extendTables[$col][3]); $field_ob->WithLabel(false); if (!$this->extendTables[$col][4]) { $this->extendTables[$col][4] = true; } if (in_array($col, $this->parentAttr)) { $field_ob->SetValueField($_REQUEST[$col]); } $field_ob->setWithAdd($this->extendTables[$col][4]); $field_ob->SetExtra($this->extra[$col]); $field_ob->SetInputLength($this->legths[$col]); $result .= "<td>" . $field_ob->getField() . "</td>"; } foreach ($this->extraLinks as $exlink) { $result .= "<td></td>\n"; } if ($this->active == true) { $result .= "<td></td>\n"; } $i_page = 0; foreach ($query as $row_seo) { if ($i_page < 1) { if ($row_seo[$this->page_id] > 0) { $result .= "<td></td>\n"; $i_page++; } } } $i_dublicate = 0; foreach ($query as $row_dublicate) { if ($i_dublicate < 1) { if ($this->display == true) { $result .= "<td></td>\n"; $i_dublicate++; } } } if ($this->special == true) { $result .= "<td></td>\n"; } if ($this->static != '') { $result .= "<td></td>\n"; } if ($this->seo == true) { $result .= "<td></td>\n"; } if ($this->widget == true) { $result .= "<td></td>\n"; } if ($this->view_page == true) { $result .= "<td></td>\n"; } if ($this->edit != '') { $result .= "<td><button type='submit' class='btn-e-r btn btn-danger btn-sm'>" . $this->icons->ico['save'] . "</button></td>\n"; } if ($this->delete == true) { $result .= "<td></td>\n"; } $result .= "</tr>"; } } foreach ($query as $row) { $id = stripcslashes($row[$this->f_id]); if ($id == $_REQUEST['id'] && $_REQUEST['action'] == '_edit') { $result .= "<tr><input type='hidden' name='{$this->f_id}' value='" . $_REQUEST[$this->f_id] . "'>"; $result .= $this->getParametersToPassIt(); $result .= $this->getParentAttr(); if ($this->order == true) { $script .= "ordIds[{$m}]='{$id}';"; } $m++; foreach ($this->columns as $column) { $value = ""; $value = stripcslashes($row[$column]); if (isset($this->source[$column]) && $this->source[$column] != '') { $value = $this->lookupField($this->source[$column][0], $this->source[$column][1], $this->source[$column][2], $row[$column]); } if ($this->types[$column] == 'photos') { $value = $this->ViewPhotos($value, 1, 1, 50, 50); } $field_ob = new field(); $field_ob->SetIdField($column); $field_ob->SetNameField($column); $field_ob->SetCssClass($this->classes[$column]); $field_ob->SetTypeField($this->types[$column]); $field_ob->SetTable($this->extendTables[$column][0]); $field_ob->SetRequiredField($this->requireds[$col]); $field_ob->SetTname($this->extendTables[$column][1]); $field_ob->SetTvalue($this->extendTables[$column][2]); $field_ob->SetValueField(stripcslashes($row[$column])); $field_ob->setWhere($this->extendTables[$column][3]); $field_ob->WithLabel($withLabel); if (!$this->extendTables[$column][4]) { $this->extendTables[$column][4] = true; } $field_ob->setWithAdd($this->extendTables[$column][4]); $field_ob->SetExtra($this->extra[$column]); $field_ob->SetInputLength($this->legths[$column]); if ($this->types[$column] != "") { $result .= "<td>" . $field_ob->getField() . "</td>"; } elseif ($this->types[$column] == "" && $column == 'l_key') { $result .= "<td>" . $field_ob->getField() . "</td>"; } else { $result .= "<td>" . $value . $field_ob->getField() . "</td>"; } } foreach ($this->extraLinks as $exlink) { $result .= "<td></td>\n"; } if ($this->active == true) { $result .= "<td></td>\n"; } $i_page = 0; foreach ($query as $row_seo) { if ($i_page < 1) { if ($row_seo[$this->page_id] > 0) { $result .= "<td></td>\n"; $i_page++; } } } $i_dublicate = 0; foreach ($query as $row_dublicate) { if ($i_dublicate < 1) { if ($this->display == true) { $result .= "<td></td>\n"; $i_dublicate++; } } } if ($this->special == true) { $result .= "<td></td>\n"; } if ($this->static != '') { $result .= "<td></td>\n"; } if ($this->seo == true) { $result .= "<td></td>\n"; } if ($this->widget == true) { $result .= "<td></td>\n"; } if ($this->view_page == true) { $result .= "<td></td>\n"; } if ($this->edit != '') { $result .= "<td><button type='submit' class='btn-e-r btn btn-danger btn-sm'>" . $this->icons->ico['save'] . "</button></td>\n"; } if ($this->delete == true) { $result .= "<td></td>\n"; } $result .= "</tr>\n"; } else { $result .= "<tr id=" . $id . ">\n"; if ($this->order == true) { $script .= "ordIds[{$m}]='{$id}';"; } $m++; foreach ($this->columns as $column) { $value = ""; $value = stripcslashes($row[$column]); if (isset($this->source[$column]) && $this->source[$column] != '') { $value = $this->lookupField($this->source[$column][0], $this->source[$column][1], $this->source[$column][2], $row[$column]); } if ($this->types[$column] == 'photos') { $value = $this->ViewPhotos($value, 1, 1, 50, 50); } if ($this->types[$column] == 'flag') { $value = "" . $this->switcher($this->db_table, $row[$this->f_id], $column, $row[$column], "SwitcherV") . ""; } if ($this->types[$column] == 'checkbox' && $this->source[$column][0] != "") { $value = $this->getValuesImplode($this->source[$column][0], $this->source[$column][1], $this->source[$column][2], stripcslashes($row[$column])); } if ($this->types[$column] == 'checkbox' && $this->source[$column][0] == "") { $module = $this->fpdo->from('cms_modules')->where('id', $_SESSION['cmsMID'])->fetch(); $table = $module['table_name']; $langType = $module['lang_type']; $fileds = $this->fpdo->from('cms_module_fields')->where("table_id='" . $_SESSION['cmsMID'] . "' and plus !='' and type='checkbox'")->fetch(); if ($fileds['plus']) { $value = $fileds['plus']; } // $value = $this->getValuesImplode($this->source[$column][0], $this->source[$column][1], $this->source[$column][2], stripcslashes($row[$column])); } $result .= "<td data-type='" . $this->types[$column] . "' data-table='" . $this->db_table . "' data-id='" . $row[$this->f_id] . "' data-field='" . $column . "' data-extratable='" . $this->source[$column][0] . "' data-extraid='" . $this->source[$column][1] . "' data-extraname='" . $this->source[$column][2] . "' data-extravalue='" . $row[$column] . "' class='EditInline'>" . $value . "<span></span></td>\n"; } foreach ($this->extraLinks as $exlink) { $linkAttr = $exlink[3]; $linkO = array(); foreach ($linkAttr as $key => $attr) { if (is_int($attr)) { array_push($linkO, "{$key}=" . $attr); } else { array_push($linkO, "{$key}=" . $row[$attr]); } } $linkO = implode('&', $linkO); $result .= "<td align='center'><a title='" . $exlink[0] . "' data-toggle='tooltip' href='{$exlink['2']}?{$linkO}' target='{$exlink['4']}'>{$exlink['1']}</a></td>\n"; } if ($this->active == true) { $result .= "<td align='center'>" . $this->switcher($this->db_table, $row[$this->f_id], $this->f_active, $row[$this->f_active], "SwitcherV") . "</td>\n"; } if ($this->special == true) { $result .= "<td align='center'>" . $this->switcher($this->db_table, $row[$this->f_id], $this->f_special, $row[$this->f_special], "SwitcherV") . "</td>\n"; } if ($this->static != '') { $result .= "<td align='center'>" . $this->switcher($this->db_table, $row[$this->f_id], $this->f_static, $row[$this->f_static], "SwitcherV") . "</td>\n"; } if ($row[$this->page_id] != "") { $id_seo = $row[$this->page_id]; $result .= "<td align='center'><a href='javascript:;' data-id='{$id_seo}' class='seoModal'>" . $this->icons->ico['seo'] . "</a></td>\n"; $i_page++; } if ($this->display == true) { $cols_pass = ""; foreach ($this->cols_insert as $col_insert) { $cols_pass .= $col_insert . ","; } $result .= "<td align='center'><a href='javascript:;' data-id='" . $row[$this->record_id] . "' data-redirect='" . $this->redirect . "' data-table='" . $this->table_name . "' data-cols='" . $cols_pass . "' data-module='" . $this->module_id . "' data-ajax='" . $this->ajaxFile . "' class='dublicate-button'>" . $this->icons->ico['dublicate'] . "</a></td>\n"; } if ($this->seo == true) { $result .= "<td align='center'><a href='{$this->seo}' >" . $this->icons->ico['seo'] . "</a></td>\n"; } if ($this->widget == true) { $result .= "<td align='center'><a href='{$this->widget}'>" . $this->icons->ico['widget'] . "</a></td>\n"; } if ($this->view_page == true) { $link_page = $this->view_page . "page" . $id . '/page-title'; $result .= "<td align='center'><a href='{$link_page}' target='_blank'>" . $this->icons->ico['view'] . "</a></td>\n"; } if ($this->edit != '') { $editLink = $this->edit; $i = 0; foreach ($this->editParametar as $par) { if ($i > 0) { $editLink .= "&"; } else { $editLink .= "?"; } $editLink .= $par . "=" . $row[$par]; $i++; } if ($this->isGridList) { $con = ""; foreach ($_REQUEST as $key => $v) { if ($key != "PHPSESSID" && $key != "site_id" && $key != "action" && $key != $this->f_id) { $con .= "&{$key}={$v}"; } } $editLink = $_SERVER['PHP_SELF'] . "?action=_edit&{$this->f_id}={$id}" . $con; } $result .= "<td align='center'><a href='{$editLink}' title='" . $this->getConstant("edit") . "' data-toggle='tooltip'>" . $this->icons->ico['edit'] . "</a></td>\n"; } if ($this->delete == true) { $result .= "<td><input type='checkbox' name='DeleteRow[]' value='{$id}' class='checkbox'></td>\n"; } $result .= "</tr>\n"; } } $result .= "</tbody>\n"; $result .= "</table>\n"; $result .= "</form>\n"; $result .= " </div>\n"; $result .= "<div class='box-footer'>"; if ($this->extraHtml != "") { $result .= $this->extraHtml; } if ($this->backBtn != "" || $this->backBtn != false) { $result .= $this->back($this->backBtn, 'pull-left'); } if ($this->saveAndContinue != "" && count($this->saveAndContinue) > 0) { $result .= $this->back($this->saveAndContinue['link'], "pull-left " . $this->saveAndContinue['class'], $this->saveAndContinue['title']); } if ($this->saveAndClose != "" && count($this->saveAndClose) > 0) { $result .= $this->back($this->saveAndContinue['link'], 'pull-left' . $this->saveAndContinue['class'], $this->saveAndContinue['title']); } global $pn, $LPP; $pageLink = $this->pageList . "?pn=^"; foreach ($this->filter as $f) { if ($_REQUEST[$f[0]] != "") { $pageLink .= "&{$f['0']}=" . $_REQUEST[$f[0]]; } } foreach ($this->parentAttr as $f) { if ($_REQUEST[$f] != "") { $pageLink .= "&{$f}=" . $_REQUEST[$f]; } } if ($_REQUEST["lpp"] != "") { $pageLink .= "&lpp=" . $_REQUEST["lpp"]; } $result .= $this->create_pagination($this->getCount(), $pn, $LPP, $pageLink, 'en', 'pull-right'); $result .= "</div>"; $result .= " </div>\n"; } else { echo $this->getConstant("NoResult"); } $result .= "<script>{$script}</script>\n"; return $result; }