+trait Pman_Core_RooGetTrait {
+ /**
+ * GET method Roo/TABLENAME.php
+ *
+ * Generally for SELECT or Single SELECT
+ *
+ * Single SELECT:
+ * _id=value single fetch based on primary id.
+ * can be '0' if you want to fetch a set of defaults
+ * Use in conjuntion with toRooSingleArray()
+ *
+ * lookup[key]=value single fetch based on a single key value lookup.
+ * multiple key/value can be used. eg. ontable+onid..
+ * _columns what to return.
+ *
+ *
+ * JOINS:
+ * - all tables are always autojoined.
+ *
+ * Search SELECT
+ * COLUMNS to fetch
+ * _columns=a,b,c,d comma seperated list of columns.
+ * _columns_exclude=a,b,c,d comma seperated list of columns.
+ * _distinct=name a distinct column lookup. you also have to use _columns with this.
+ *
+ * WHERE (searches)
+ * colname = ... => colname = ....
+ * !colname=.... => colname != ....
+ * !colname[0]=... !colname[1]=... => colname NOT IN (.....) ** only supports main table at present..
+ * colname[0]=... colname[1]=... => colname IN (.....) ** only supports main table at present..
+ *
+ * ORDER BY
+ * sort=name what to sort.
+ * sort=a,b,d can support multiple columns
+ * dir=ASC what direction
+ * _multisort ={...} JSON encoded { sort : { row : direction }, order : [ row, row, row ] }
+ *
+ * LIMIT
+ * start=0 limit start
+ * limit=25 limit number
+ *
+ *
+ * Simple CSV support
+ * csvCols[0] csvCols[1].... = .... column titles for CSV output
+ * csvTitles[0], csvTitles[1] .... = columns to use for CSV output
+ *
+ * Depricated
+ * _toggleActive !:!:!:! - this hsould not really be here..
+ * query[add_blank] - add a line in with an empty option... - not really needed???
+ * _delete = delete a list of ids element. (depricated.. this will be removed...)
+ *
+ * DEBUGGING
+ * _post =1 = simulate a post with debuggin on.
+ * _debug_post << This is prefered, as _post may overlap with accouting posts..
+ *
+ * _debug = turn on DB_dataobject deubbing, must be admin at present..
+ *
+ *
+ * CALLS methods on dataobjects if they exist
+ *
+ *
+ * checkPerm('S' , $authuser)
+ * - can we list the stuff
+ * - return false to disallow...
+ * applySort($au, $sortcol, $direction, $array_of_columns, $multisort)
+ * -- does not support multisort at present..
+ * applyFilters($_REQUEST, $authUser, $roo)
+ * -- apply any query filters on data. and hide stuff not to be seen.
+ * -- can exit by calling $roo->jerr()
+ * postListExtra($_REQUEST) : array(extra_name => data)
+ * - add extra column data on the results (like new messages etc.)
+ * postListFilter($data, $authUser, $request) return $data
+ * - add extra data to an object
+ *
+ *
+ * toRooSingleArray($authUser, $request) : array
+ * - called on single fetch only, add or maniuplate returned array data.
+ * - is also called when _id=0 is used (for fetching a default set.)
+ * toRooArray($request) : array
+ * - called if singleArray is unavailable on single fetch.
+ * - always tried for mutiple results.
+ * toArray() - the default method if none of the others are found.
+ *
+ * autoJoin($request)
+ * - standard DataObject feature - causes all results to show all
+ * referenced data.
+ *
+ * PROPERTIES:
+ * _extra_cols -- if set, then filtering by column etc. will use them.
+ *
+
+ */
+ function get($tab)
+ {
+ // $this->jerr("Not authenticated", array('authFailure' => true));
+ //echo '<PRE>';print_R($_GET);
+ //DB_DataObject::debuglevel(1);
+
+ $this->init(); // from pman.
+ //DB_DataObject::debuglevel(1);
+ HTML_FlexyFramework::get()->generateDataobjectsCache($this->isDev);
+
+
+
+ // debugging...
+
+
+
+ if ( $this->checkDebugPost()) {
+
+
+
+ $_POST = $_GET;
+ //DB_DAtaObject::debuglevel(1);
+ return $this->post($tab);
+ }
+
+ $this->checkDebug();
+
+ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($this, 'onPearError'));
+
+ $tab = array_shift(explode('/', $tab));
+ $x = $this->dataObject($tab);
+
+ $_columns = !empty($_REQUEST['_columns']) ? explode(',', $_REQUEST['_columns']) : false;
+
+ if (isset( $_REQUEST['lookup'] ) && is_array($_REQUEST['lookup'] )) { // single fetch based on key/value pairs
+ $this->selectSingle($x, $_REQUEST['lookup'],$_REQUEST);
+ // actually exits.
+ }
+
+
+ // single fetch (use '0' to fetch an empty object..)
+ if (isset($_REQUEST['_id']) && is_numeric($_REQUEST['_id'])) {
+
+ $this->selectSingle($x, $_REQUEST['_id'],$_REQUEST);
+ // actually exits.
+ }
+
+ // Depricated...