|
But what? We call a method that does not exist. Unfortunately LibertyAttachable does not come with a method that could easily be there: getList(). And so we will have to create that for ourselves:
|
{code}
|
- function getList( &$pParamHash ) {
|
- global $gBitSystem, $gBitUser;
|
+function getList( &$pParamHash ) { |
+ global $gBitSystem, $gBitUser; |
|
- // this makes sure parameters used later on are set
|
- LibertyContent::prepGetList( $pParamHash );
|
+ LibertyContent::prepGetList( $pParamHash );// this makes sure parameters used later on are set |
|
- $selectSql = $joinSql = $whereSql = '';
|
- $bindVars = array();
|
- array_push( $bindVars, $this->mContentTypeGuid );
|
- $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars );
|
+ $selectSql = $joinSql = $whereSql = ''; |
+ $bindVars = array(); |
+ array_push( $bindVars, $this->mContentTypeGuid ); |
+ $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); |
|
- // this will set $find, $sort_mode, $max_records and $offset
|
- extract( $pParamHash );
|
+ extract( $pParamHash );// this will set $find, $sort_mode, $max_records and $offset |
|
- if( is_array( $find ) ) {
|
- // you can use an array of pages
|
- $whereSql .= " AND lc.`title` IN( ".implode( ',',array_fill( 0,count( $find ),'?' ) )." )";
|
- $bindVars = array_merge ( $bindVars, $find );
|
- } elseif( is_string( $find ) ) {
|
- // or a string
|
- $whereSql .= " AND UPPER( lc.`title` )like ? ";
|
- $bindVars[] = '%' . strtoupper( $find ). '%';
|
- }
|
+ if( is_array( $find ) ) { // you can use an array of pages |
+ $whereSql .= " AND lc.`title` IN( ".implode( ',',array_fill( 0,count( $find ),'?' ) )." )"; |
+ $bindVars = array_merge ( $bindVars, $find ); |
+ } elseif( is_string( $find ) ) { // or a string |
+ $whereSql .= " AND UPPER( lc.`title` )like ? "; |
+ $bindVars[] = '%' . strtoupper( $find ). '%'; |
+ } |
|
- $query = "SELECT lc.`content_id`, lc.`title`, lc.`data` $selectSql
|
- FROM `".BIT_DB_PREFIX."liberty_content` lc $joinSql
|
- WHERE lc.`content_type_guid` = ? $whereSql
|
- ORDER BY ".$this->mDb->convert_sortmode( $sort_mode );
|
- $query_cant = "select count(*)
|
- FROM `".BIT_DB_PREFIX."eventcal_events` ts INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = ts.`content_id` ) $joinSql
|
- WHERE lc.`content_type_guid` = ? $whereSql";
|
+ $query = "SELECT lc.`content_id`, lc.`title`, lc.`data` $selectSql |
+ FROM `".BIT_DB_PREFIX."liberty_content` lc $joinSql |
+ WHERE lc.`content_type_guid` = ? $whereSql |
+ ORDER BY ".$this->mDb->convert_sortmode( $sort_mode ); |
+ $query_cant = "select count(*) |
+ FROM `".BIT_DB_PREFIX."eventcal_events` ts |
+ INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON( lc.`content_id` = ts.`content_id` ) |
+ $joinSql |
+ WHERE lc.`content_type_guid` = ? $whereSql"; |
|
$result = $this->mDb->query( $query, $bindVars, $max_records, $offset );
|
$ret = array();
|