Created frames table with migration
This commit is contained in:
@@ -56,7 +56,7 @@ class Frame
|
||||
if (! $this->hasFlag('ip')) {
|
||||
// Set the page header: CUG/Site Name | Page # | Cost
|
||||
$this->output .= $this->render_header($this->header).
|
||||
$this->render_page($this->frame->frame_id,$this->frame->subframe_id).
|
||||
$this->render_page($this->frame->frame,$this->frame->index).
|
||||
$this->render_cost($this->frame->cost);
|
||||
}
|
||||
|
||||
@@ -93,14 +93,14 @@ class Frame
|
||||
for ($x=0;$x<$this->frame_width;$x++)
|
||||
{
|
||||
$posn = $y*40+$x;
|
||||
$byte = ord(isset($this->frame->frame_content{$posn}) ? $this->frame->frame_content{$posn} : ' ')%128;
|
||||
$byte = ord(isset($this->frame->content{$posn}) ? $this->frame->content{$posn} : ' ')%128;
|
||||
// dump(sprintf('Y: %s,X: %s, POSN: %s, BYTE: %s',$y,$x,$posn,$byte));
|
||||
|
||||
// Check for start-of-field
|
||||
if ($byte == ord(ESC)) { // Esc designates start of field (Esc-K is end of edit)
|
||||
$infield = TRUE;
|
||||
$fieldlength = 0;
|
||||
$fieldtype = ord(substr($this->frame->frame_content,$posn+1,1))%128;
|
||||
$fieldtype = ord(substr($this->frame->content,$posn+1,1))%128;
|
||||
$byte = ord(' '); // Replace ESC with space.
|
||||
|
||||
} else {
|
||||
@@ -132,7 +132,7 @@ class Frame
|
||||
// Replace field with Date
|
||||
if ($field == '%date') {
|
||||
if ($fieldlength == 1)
|
||||
$datetime = strtoupper(date('D d M Y H:i:s'));
|
||||
$datetime = date('D d M H:ia');
|
||||
|
||||
if ($fieldlength <= strlen($datetime))
|
||||
$byte = ord($datetime{$fieldlength-1});
|
||||
@@ -168,7 +168,7 @@ class Frame
|
||||
}
|
||||
|
||||
// truncate end of lines
|
||||
if (isset($pageflags['tru']) && substr($this->frame->frame_content,$y*40+$x,40-$x) === str_repeat(' ',40-$x)) {
|
||||
if (isset($pageflags['tru']) && substr($this->frame->content,$posn,40-$x) === str_repeat(' ',40-$x)) {
|
||||
$this->output .= CR . LF;
|
||||
break;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class Frame
|
||||
*/
|
||||
public function framenum()
|
||||
{
|
||||
return $this->frame->frame_id.$this->frame->subframe_id;
|
||||
return $this->frame->frame.$this->frame->index;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,6 +253,17 @@ class Frame
|
||||
return sprintf(WHITE.'% '.$this->pagenum_length.'.0f%s',$num,$frame);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route for the key press
|
||||
*
|
||||
* @param string $read
|
||||
*/
|
||||
public function route(string $read)
|
||||
{
|
||||
// @todo
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the length of text
|
||||
*
|
||||
@@ -270,21 +281,21 @@ class Frame
|
||||
// Simulate a DB load
|
||||
$o = new \App\Models\Frame;
|
||||
|
||||
$o->frame_content = '';
|
||||
$o->content = '';
|
||||
$o->flags = ['ip'];
|
||||
$o->frametype = 'a';
|
||||
$o->frame_id = 999;
|
||||
$o->subframe_id = 'a';
|
||||
$o->type = 'a';
|
||||
$o->frame = 999;
|
||||
$o->index = 'a';
|
||||
|
||||
// Header
|
||||
$o->frame_content .= substr(R_RED.'T'.R_BLUE.'E'.R_GREEN.'S'.R_YELLOW.'T-12345678901234567890',0,20).
|
||||
$o->content .= substr(R_RED.'T'.R_BLUE.'E'.R_GREEN.'S'.R_YELLOW.'T-12345678901234567890',0,20).
|
||||
R_WHITE.'999999999a'.R_RED.sprintf('%07.0f',999).'u';
|
||||
|
||||
$o->frame_content .= str_repeat('+-',18).' '.R_RED.'01';
|
||||
$o->frame_content .= 'Date: '.ESC.str_repeat('d',25).str_repeat('+-',4);
|
||||
$o->frame_content .= 'Name: '.ESC.str_repeat('u',5).str_repeat('+-',14);
|
||||
$o->frame_content .= 'Address: '.ESC.str_repeat('a',20).''.str_repeat('+-',5);
|
||||
$o->frame_content .= ' : '.ESC.str_repeat('a',20).''.str_repeat('+-',5);
|
||||
$o->content .= str_repeat('+-',18).' '.R_RED.'01';
|
||||
$o->content .= 'Date: '.ESC.str_repeat('d',25).str_repeat('+-',4);
|
||||
$o->content .= 'Name: '.ESC.str_repeat('u',5).str_repeat('+-',14);
|
||||
$o->content .= 'Address: '.ESC.str_repeat('a',20).''.str_repeat('+-',5);
|
||||
$o->content .= ' : '.ESC.str_repeat('a',20).''.str_repeat('+-',5);
|
||||
|
||||
return $o;
|
||||
}
|
||||
|
Reference in New Issue
Block a user