- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
<?
require_once('ittable.class.php');
class ITForm extends ITTable
{
public function __construct($tbl)
{
parent::__construct($tbl);
//путь с скрипту который удаляет файлы по tblname record_id filename
$this->path2deletephp='/itcms4/ckeditor/delete.php';
}
public function printForm($i, $action, $head, $submitvalue='', $captcha=0)
{
$form = $this->generateFormData($i, $action, $head, $submitvalue, $captcha);
print "<h1>$form->head</h1>
$form->begin
$form->inputhidden
<table>";
foreach($form->inputs as $k=>$v)
print "<tr id='itforms_$k'" . ($this->columns[$k]->blockclass?' class="' . $this->columns[$k]->blockclass . '"':'') ."><td>$v->name</td><td>$v->input</td></tr>\n";
print "</table>
$form->files
<hr><input type='submit' value='$form->submitvalue'></form>
<script type='text/javascript'>
var itform;
$(document).ready(function()
{
itform = new ITForm($('#$this->tbl$i->id'));
$form->js
});
</script>
";
}
public function insertForm($head, $submitvalue='', $i=0)
{
if(!$i)
$i = new stdClass();
$copy_id = intval($_GET['copy_id']);
if($copy_id)
{
$r=exec_mysql_query("SELECT * FROM $this->tbl WHERE id='$copy_id'");
$row=mysql_fetch_array($r);
foreach($row as $k=>$v)
if(!isset($i->$k))
$i->$k = $v;
}
//чтобы можно было загрузить файлы делаем временный id в диапазоне от 10^7 до 2*10^9
$i->id = 'r' . rand(10000000, 2000000000);
$this->printForm($i, 'insert.php', $head, $submitvalue);
}
public function updateForm($id, $head, $submitvalue='')
{
$this->printForm($this->getObject($id), 'update.php', $head, $submitvalue);
if(mysql_numrows(exec_mysql_query("SELECT id FROM it_updatelog WHERE tbl='$this->tbl' AND record_id='$id'")))
print "<a href=/crm2/log/?w_tbl_2=$this->tbl&w_record_id_1=$id>История изменений</a><br>";
}
public function deleteForm($id, $head, $submitvalue='')
{
$this->printForm($this->getObject($id), 'delete.php', $head, $submitvalue);
}
public function updateForm4Object($o, $head, $submitvalue='')
{
$this->printForm($o, 'update.php', $head, $submitvalue);
if(mysql_numrows(exec_mysql_query("SELECT id FROM it_updatelog WHERE tbl='$this->tbl' AND record_id='$o->id'")))
print "<a href=/crm2/log/?w_tbl_2=$this->tbl&w_record_id_1=$o->id>История изменений</a><br>";
}
http://www.itcms.info/img/upload/00161bd3_medium.gif
Что тебя в этом разьубеждило?