function cut_words($params) { if (!$params[1]) { $params[1] = ' '; } if (isset($params[3])) { return XSTRING::findncut_symbol_positon($params[0], $params[1], $params[2], $params[3]); } return XSTRING::findncut_symbol_positon($params[0], $params[1], $params[2]); }
function CreateView() { global $TDB; if (!$this->_options['page_num_where']) { $this->_options['page_num_where'] = $this->_options['where']; } $this->pages_num = Common::get_nav_pages($this->_options['table'], $this->_options['rows_per_page'], $this->_options['page_num_where']); if (!$this->_options['startRow']) { $this->_options['startRow'] = 0; } if ($this->_options['rows_per_page']) { $limit = ' limit ' . $this->_options['startRow'] . ' , ' . $this->_options['rows_per_page']; } else { $limit = ''; } if ($this->_options['where']) { $where = ' where ' . $this->_options['where']; } if (!$this->_options['customSqlQuery']) { $query = 'select ' . implode(',', $this->_options['columns']) . ' from ' . $this->_options['table'] . $where . $limit; } else { $query = $this->_options['customSqlQuery']; } if ($results = $TDB->get_results($query)) { if ($this->_options['filter'] or $this->_options['gridFormat']) { while (list($id, $record) = each($results)) { if ($this->_options['filter']) { foreach ($this->_options['filter'] as $field => $filter) { switch ($filter['name']) { case 'fromtimestamp': $record[$field] = date($filter['format'], $record[$field]); break; case 'cutwords': $record[$field] = XSTRING::findncut_symbol_positon($record[$field], " ", $filter['count']); break; } } } $result[$id] = $record; if ($this->_options['gridFormat']) { foreach ($record as $key => $val) { if ($this->_options['callfunc'][$key]) { $context = $this->_options['callfunc'][$key][0]; $func = $this->_options['callfunc'][$key][1]; $result[$id][$key] = $context->{$func}($val, $id); } } $nsq = null; if (is_array($this->_options['sequence'])) { foreach ($this->_options['sequence'] as $sq) { $nsq[] = $result[$id][$sq]; } $result[$id] = $nsq; } $result['rows'][$result[$id][0]] = array('data' => array_values($result[$id])); unset($result[$id]); } } return $result; } else { return $results; } } }
} //трансформ по функции if ($tempValue['onAttribute']) { $extData[$tempValue['name']] = $tempValue['onAttribute']($tempValue['onAttributeParams'], $extData[$tempValue['name']], $id); } } if ($this->_options['onRecord']) { $extData = $this->_options['onRecord']($extData); } if ($this->_options['gridFormat']) { $r = array('id' => $id, 'data' => $extData, 'obj_type' => $node['obj_type']); if ($childsNodes->HasChild($id)) { $r['xmlkids'] = 1; } $result['data_set']['rows'][$id] = $r; } else { $result['data_set'][$id] = $extData; } } } return $result; } } } //endclass treeJsonSource::$fromTimeStamp = function ($params, $value, $id) { return date($params['format'], $value); }; treeJsonSource::$cutWords = function ($params, $value) { return XSTRING::findncut_symbol_positon($value, " ", $params['count']); };