示例#1
0
 function __construct($qg)
 {
     parent::__construct('div');
     $this->qg = $qg;
     $this->css_style['padding'] = '0px';
     $this->css_style['margin'] = '0px';
     $this->css_style['border'] = '0px';
     $this->table = new dom_table();
     $this->row = new dom_tr();
     $this->hrow = new dom_tr();
     $this->hrow->css_class = 'head';
     $this->table->css_style['page-break-after'] = 'always';
     $this->table->css_style['padding'] = '0px';
     $this->table->css_style['margin'] = '0px';
     $this->table->css_style['border'] = '0px';
     $this->table->css_style['border-collapse'] = 'collapse';
     $this->row->css_style['height'] = '8mm';
     foreach ($this->qg->what->exprs as $e) {
         if ($e->alias == '') {
             print "You should specify an alias for each column.";
             exit;
         }
         $this->txts[$e->alias] = new dom_statictext();
         $this->htxts[$e->alias] = new dom_statictext($e->alias);
         $td = new dom_td();
         unset($td->id);
         $div = new dom_div();
         unset($div->id);
         $div->append_child($this->txts[$e->alias]);
         $td->append_child($div);
         $this->row->append_child($td);
         $td = new dom_td();
         unset($td->id);
         $div = new dom_div();
         unset($div->id);
         $div->append_child($this->htxts[$e->alias]);
         $td->append_child($div);
         $this->hrow->append_child($td);
     }
     unset($this->row->id);
     unset($this->table->id);
     $this->append_child($this->table);
     $this->table->append_child($this->hrow);
     $this->table->append_child($this->row);
     $this->row_height = 16.0;
     $this->page_height = 270.0;
 }
示例#2
0
 function append_child($c)
 {
     switch ($this->__model) {
         case '':
         case 'raw':
             //simply put child into listdiv
             $this->listdiv->append_child($c);
             break;
         case 'div':
             //put child into individual div. Then put this div into listdiv
             $div = new dom_div();
             $div->append_child($c);
             $this->listdiv->append_child($div);
             break;
         case 'table':
             //the most quirky layout. Create fixed width rows
             if ($this->__table_row_pos == 0) {
                 $this->__table_temp_row = new dom_tr();
                 $this->listdiv_table->append_child($this->__table_temp_row);
                 if ($this->__table_row_cnt <= 0) {
                     $this->__table_row_pos = 1;
                 } else {
                     $this->__table_row_pos = $this->__table_row_cnt;
                 }
             }
             if ($this->__table_row_pos > 0) {
                 $td = new dom_td();
                 $td->append_child($c);
                 $this->__table_temp_row->append_child($td);
                 $this->__table_row_pos--;
                 break;
             }
     }
 }
示例#3
0
 function __construct()
 {
     parent::__construct();
     $this->etype = get_class($this);
     editor_generic::addeditor('rn', new editor_statictext());
     editor_generic::addeditor('s', new editor_statictext());
     editor_generic::addeditor('d', new editor_statictext());
     $this->tbl = new dom_table();
     $this->append_child($this->tbl);
     $this->tr = new dom_tr();
     $this->tbl->append_child($this->tr);
     $td1 = new dom_td();
     $td2 = new dom_td();
     $td3 = new dom_td();
     $td1->append_child($this->editors['rn']);
     $td2->append_child($this->editors['s']);
     $td3->append_child($this->editors['d']);
     $this->tr->append_child($td1);
     $this->tr->append_child($td2);
     $this->tr->append_child($td3);
 }
示例#4
0
 function prepare()
 {
     global $sql;
     $st = new settings_tool();
     $r = $sql->q1($st->single_query($this->oid, 'mq', $_SESSION['uid'], 0));
     if ($r != '') {
         $res = unserialize($r);
     } else {
         $res = new meta_query_gen();
     }
     $this->meta_query = $res;
     $r = $sql->q1($st->single_query($this->oid, 'ed_count', $_SESSION['uid'], 0));
     if ($r != '') {
         $res = intval($r);
     } else {
         $res = 10;
     }
     $ed_count = $res;
     $r = $sql->q1($st->single_query($this->oid, 'ed_offset', $_SESSION['uid'], 0));
     if ($r != '') {
         $res = intval($r);
     } else {
         $res = 0;
     }
     $ed_offset = $res;
     $colidx = 0;
     if (is_array($this->meta_query->result_def->children)) {
         foreach ($this->meta_query->result_def->children as $r) {
             if (get_class($r) == 'fm_meta_object') {
                 $hrarr = $sql->qkv("SELECT a.id,coalesce(b.val,a.name) as hr_name FROM `" . TABLE_META_TREE . "` as a LEFT OUTER JOIN `" . TABLE_META_I18N . "` as b ON a.id=b.object AND b.var='name' AND b.loc='" . $_SESSION['lang'] . "' WHERE a.id IN (" . str_replace('.', ',', $r->path) . ")");
                 $hrt = '';
                 $hrm = '';
                 foreach ($hrarr as $kk => $e) {
                     if ($hrt != '') {
                         $hrt .= '.';
                     }
                     $hrt .= $e;
                     if ($hrm != '') {
                         $hrm .= '.';
                     }
                     $hrm .= $kk;
                 }
             } else {
                 $hrt = 'expression ' . $colidx;
                 $hrm = '';
             }
             $td = new dom_td();
             unset($td->id);
             $td->append_child(new dom_statictext($hrt));
             $td->attributes['title'] = $hrm;
             $this->c_c->append_child($td);
             editor_generic::addeditor('cd' . $colidx, new editor_statictext());
             $td = new dom_td();
             unset($td->id);
             $td->append_child($this->editors['cd' . $colidx]);
             $this->c_d->append_child($td);
             $colidx++;
         }
     }
     $this->meta_query->oid = $this->oid;
     $this->sql_obj = $this->meta_query->to_show();
     $this->sql_obj->lim_count = $ed_count;
     $this->sql_obj->lim_offset = $ed_offset;
     $colidx1 = 0;
     if (is_array($this->sql_obj->what->exprs)) {
         foreach ($this->sql_obj->what->exprs as $e) {
             $e->alias = 'cd' . $colidx1;
             $colidx1++;
         }
     }
 }