Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
all Кураченко(В).doc
Скачиваний:
8
Добавлен:
28.08.2019
Размер:
10.93 Mб
Скачать

Приложение и Листинг

Листинг модуля обработки присланных документов:

function Write($h, $txt, $link='')

{// Выход текст в потоковом режиме

$cw=&$this->CurrentFont['cw'];

$w=$this->w-$this->rMargin-$this->x;

$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

$s=str_replace("\r",'',$txt);

$nb=strlen($s);

$sep=-1;

$i=0;

$j=0;

$l=0;

$nl=1;

while($i<$nb)

{//Получение следующего символа

$c=$s[$i];

if($c=="\n")

{//Разрыв строки

$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);

$i++;

$sep=-1;

$j=$i;

$l=0;

if($nl==1)

{ $this->x=$this->lMargin;

$w=$this->w-$this->rMargin-$this->x;

$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

}

$nl++;

continue;

}

if($c==' ')

$sep=$i;

$l+=$cw[$c];

if($l>$wmax)

{//Автоматически прервыание

if($sep==-1)

{if($this->x>$this->lMargin)

{//Перемещение на следующую линию

$this->x=$this->lMargin;

$this->y+=$h;

$w=$this->w-$this->rMargin-$this->x;

$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

$i++;

$nl++;

continue;

}

if($i==$j)

$i++;

$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);}

else

{ $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);

$i=$sep+1;

}

$sep=-1;

$j=$i;

$l=0;

if($nl==1)

{ $this->x=$this->lMargin;

$w=$this->w-$this->rMargin-$this->x;

$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;

}

$nl++;

}else

$i++; }

Листинг формирования рабочей области, загрузка модулей :

class kernel {

private $module;

// Конструктор класса

function __construct() {

}

function load($m_dir) {

$d = dir($m_dir);

while($file = $d->read()) {

$tmp = null;

if (preg_match("/[a-z]{1,10}\.inc/i", $file)) {

require_once($m_dir.'/'.$file);

$tmp = new $_classname(intval($_SESSION['u_group']));

$menu[$tmp->GetId()] = $tmp;

//if(intval($tmp->GetIdB())) $tmp->SetIdB(++$i);

}

}

$d->close();

ksort($menu);

$this->module = $menu;

return $menu;

}

function html($filename) {

$handle = fopen($filename, "r");

$contents = fread($handle, filesize($filename));

fclose($handle);

return $contents;}

function GetMenu($name,$image,$url,$id='') {

$contents = '<tr><td class="menuleft"><a href="'.$url.'">'.$name.'</a></td></tr>';

return $contents;

}