function c_cols($d)
 {
     $h = array();
     if (!isDrw($d)) {
         $d = (array) $d;
     }
     foreach ($d as $v) {
         $h[] = cEle('td', isNumStr($v) ? array('html' => $v) : (isDrw($v) ? $v : null));
     }
     return $h;
 }
function valid_file_name($fs)
{
    if (isStr($fs)) {
        return preg_match('/[\\/:*?"<>|]/', $fs) ? preg_replace('/[\\/:*?"<>|]/', '_', $fs) : $fs;
    }
    if (isDrw($fs)) {
        $d = array();
        foreach ($fs as $v) {
            $d[] = valid_file_name($v);
        }
        return $d;
    }
}
function bullet($u, $tp)
{
    global $bullet;
    foreach ($u as $v) {
        if (isIn($v, $bullet)) {
            $t = $v;
            $u = _drw($u)->remove($v)->O;
            break;
        }
    }
    $c = cEle($tp, array('type' => isset($t) ? $t : null));
    foreach ($u as $v) {
        $a = isStr($v) || isDrw($v) ? li($v) : $v;
        $c->addChild($a);
    }
    return $c;
}
 function next_prev($i = 1, $t = 'next')
 {
     $s = $m = $this->cell;
     if (isDrw(_drw($s)->eq(0))) {
         return $this;
     }
     $this->parent();
     $s = _drw($this->cell)->eq(1);
     $this->cell = OBJ($s);
     $k = _drw($this->cell)->set_point($m);
     $r = $t == 'next' ? $k->next($i) : $k->prev($i);
     $this->cell =& $r[1];
 }
Esempio n. 5
0
 function trim($t = '')
 {
     $a = optimize_args(func_get_args());
     if (isNum($a[0])) {
         $b = shift($a);
     } else {
         $b = 0;
     }
     trim($this->O);
     for ($i = 0; $i < count($a); $i++) {
         foreach ($a as $v) {
             if (isStr($v)) {
                 if ($v == 'number') {
                     $c = '\\d';
                 } else {
                     $c = $v;
                 }
                 $lef = '^(\\/?(\\s+|)(' . $c . '+))';
                 $rig = '(' . $c . '+)?(\\s+|)$';
                 $this->O = preg_replace('/' . (!isDrw($b) ? $lef . '|' . $rig : ($b[1] < 0 ? $lef : $rig)) . '/', '', $this->O);
             }
         }
     }
     return $this;
 }
 function table_array($ag)
 {
     $a = func_get_args();
     $tab = array();
     $fields = array();
     foreach ($a as $v) {
         if (isDrw($v)) {
             foreach ($v as $k) {
                 $tab[$k] = null;
             }
         }
     }
     /*add tab as member*/
     if (isStr($a[0]) && !property_exists($this, $a[0])) {
         $this->{$a[0]} = array();
     }
     return isStr($a[0]) ? $this->{$a[0]} : $tab;
 }
 function bind($evt, $js = null)
 {
     if (!$this->more()) {
         if (isStr($evt) && isStr($js)) {
             if (strtoupper(substr($evt, 0, 2)) != 'ON') {
                 $evt = 'on' . $evt;
             }
             $m = $this->attr($evt);
             $this->attr($evt, ($m ? $m . ';' : '') . $js);
         }
         if (isDrw($evt)) {
             foreach ($evt as $i => $v) {
                 $this->bind($i, $v);
             }
         }
     } else {
         foreach ($this->O as $v) {
             _($v)->bind($evt, $js);
         }
     }
     return $this;
 }
 function create($m = null, $n = null)
 {
     $a = new DRW(func_get_args());
     while (list($i1, $v) = $a->each($l)) {
         if (isDrw($v)) {
             foreach ($v as $i => $v1) {
                 if ($i == 'type') {
                     unset($a->O[$i1][$i]);
                 }
             }
         }
     }
     $tp = 'input';
     if (!isIn($this->type, array('textarea', 'select', 'label', 'fieldset', 'legend', 'optgroup', 'option'))) {
         $a->push(array('type' => $this->type));
     } else {
         $tp = $this->type;
     }
     return Form::create($tp, $a->O);
 }
 function remove_item($i, $j = null)
 {
     if (isStr($i) && $j === null) {
         $t = explode('-', $i);
         $this->remove_item($t[0], $t[1]);
         return;
     }
     if (isNum($i) && isNum($j)) {
         $i = (int) $i;
         $j = (int) $j;
         if ($this->check_item($i, $j)) {
             $this->grid[$i][$j] = null;
         }
         return;
     }
     foreach (func_get_args() as $v) {
         if (isDrw($v)) {
             foreach ($v as $l) {
                 if (isStr($l)) {
                     $this->remove_item($l);
                 }
             }
         } elseif (isStr($v)) {
             $this->remove_item($v);
         }
     }
 }