| [ PHPXref.com ] | [ Generated: Sun Jul 20 18:52:56 2008 ] | [ MyDNSConfig 1.0.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 Copyright (c) 2005, Till Brehm, projektfarm Gmbh 5 All rights reserved. 6 7 Redistribution and use in source and binary forms, with or without modification, 8 are permitted provided that the following conditions are met: 9 10 * Redistributions of source code must retain the above copyright notice, 11 this list of conditions and the following disclaimer. 12 * Redistributions in binary form must reproduce the above copyright notice, 13 this list of conditions and the following disclaimer in the documentation 14 and/or other materials provided with the distribution. 15 * Neither the name of ISPConfig nor the names of its contributors 16 may be used to endorse or promote products derived from this software without 17 specific prior written permission. 18 19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22 IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 26 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 28 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 /** 32 * Action framework for the listform library. 33 * 34 * @author Till Brehm <t.brehm@scrigo.org> 35 * @copyright Copyright © 2005, Till Brehm 36 */ 37 38 class listform_actions { 39 40 var $id; 41 var $idx_key; 42 var $DataRowColor; 43 var $SQLExtWhere = ''; 44 45 function onLoad() { 46 global $app, $conf, $list_def_file; 47 48 if(!is_object($app->tpl)) $app->uses('tpl'); 49 if(!is_object($app->listform)) $app->uses('listform'); 50 51 // Load list definition 52 $app->listform->loadListDef($list_def_file); 53 54 if(!is_file('templates/'.$app->listform->listDef["name"].'_list.htm')) { 55 $app->uses('listform_tpl_generator'); 56 $app->listform_tpl_generator->buildHTML($app->listform->listDef); 57 } 58 59 $app->tpl->newTemplate("form.tpl.htm"); 60 $app->tpl->setInclude('content_tpl','templates/'.$app->listform->listDef["name"].'_list.htm'); 61 62 // Getting Datasets from DB 63 $records = $app->db->queryAllRecords($this->getQueryString()); 64 65 66 $this->DataRowColor = "#FFFFFF"; 67 if(is_array($records)) { 68 $this->idx_key = $app->listform->listDef["table_idx"]; 69 foreach($records as $rec) { 70 $records_new[] = $this->prepareDataRow($rec); 71 } 72 } 73 74 $app->tpl->setLoop('records',$records_new); 75 76 $this->onShow(); 77 78 79 } 80 81 function prepareDataRow($rec) { 82 global $app; 83 84 $rec = $app->listform->decode($rec); 85 86 // Alternating datarow colors 87 $this->DataRowColor = ($this->DataRowColor == "#FFFFFF")?"#EEEEEE":"#FFFFFF"; 88 $rec["bgcolor"] = $this->DataRowColor; 89 90 // substitute value for select fields 91 foreach($app->listform->listDef["item"] as $field) { 92 $key = $field["field"]; 93 if($field['formtype'] == "SELECT") { 94 $rec[$key] = $field['value'][$rec[$key]]; 95 } 96 } 97 98 // The variable "id" contains always the index variable 99 $rec["id"] = $rec[$this->idx_key]; 100 101 return $rec; 102 } 103 104 function getQueryString() { 105 global $app; 106 107 // Generate the search sql 108 if($app->listform->listDef["auth"] != 'no') { 109 if($_SESSION["s"]["user"]["typ"] == "admin") { 110 $sql_where = ""; 111 } else { 112 $sql_where = $app->tform->getAuthSQL('r')." and"; 113 } 114 } 115 116 if($this->SQLExtWhere != '') { 117 $sql_where .= " ".$this->SQLExtWhere." and"; 118 } 119 120 $sql_where = $app->listform->getSearchSQL($sql_where); 121 $app->tpl->setVar($app->listform->searchValues); 122 123 // Generate SQL for paging 124 $limit_sql = $app->listform->getPagingSQL($sql_where); 125 $app->tpl->setVar("paging",$app->listform->pagingHTML); 126 127 return "SELECT * FROM ".$app->listform->listDef["table"]." WHERE $sql_where $limit_sql"; 128 129 } 130 131 132 function onShow() { 133 global $app; 134 135 // Language File setzen 136 $lng_file = "lib/lang/".$_SESSION["s"]["language"]."_".$app->listform->listDef['name']."_list.lng"; 137 include($lng_file); 138 $app->tpl->setVar($wb); 139 $app->tpl->setVar("form_action",$app->listform->listDef["file"]); 140 141 // Parse the templates and send output to the browser 142 $this->onShowEnd(); 143 } 144 145 function onShowEnd() { 146 global $app; 147 148 $app->tpl_defaults(); 149 $app->tpl->pparse(); 150 } 151 } 152 153 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |