)
|
{/code}
|
|
+*LibertyContent::setIndexData |
*getServicesSQL
|
*prepGetList
|
*postGetList
|
|
!!!History functionality
|
How can you enable history tracking in Liberty?
|
+*LibertyContent::store and pParamHash['force_history'] |
+*LibertyContent::storeHistory |
|
!!LibertyContent
|
+LibertyContent is the base for objects to be treated by Liberty. They come with these features: |
+*their title and text content is subject to the full text seach |
!!LibertyBase
|
-!Sorted Lists
|
-Up to now, the answer is to look at the ((SamplePackage)) and guess.
|
+!!Lists, sorted and filtered |
+Now let us create a list of resources. Hopefully you already have something in your database so get something to see. As a first, insert this data with your favourite client, or even better with the data pump described below. |
+ |
+Now we will write some code that loads your data from the database. It goes to _index.php_ in your package directory. |
+{code} |
+{/code} |
+ |
+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; |
+ |
+ 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 ); |
+ |
+ 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 ). '%'; |
+ } |
+ |
+ $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(); |
+ while( $res = $result->fetchRow() ) { |
+ $ret[] = $res; |
+ } |
+ $pParamHash["cant"] = $this->mDb->getOne( $query_cant, $bindVars ); |
+ |
+ // add all pagination info to pParamHash |
+ LibertyContent::postGetList( $pParamHash ); |
+ |
+ return $ret; |
+ } |
+{/code} |
+ |
+*$gBitSmarty->assign_by_ref(...) |
*$gBitSystem->display(...)
|
-!Detail Views
|
-Up to now, the answer is to look at the ((SamplePackage)) and guess.
|
-!Feedback and Confirmation
|
+ |
+!Make something visible: The UI |
+Probably you cannot wait to display somethind on the screen. Up to now we had concentrated on your data objects - the model. Bitweaver works with the MVC pattern. Find out more about this pattern in ((Model View Controller - MVC)), but now we make use of the model, create a simple controller and focus on the view. |
+ |
+{attachment id=268 float=right padding=20px} Have a look at this picture. It should give you a rough idea of what part of a bitweaver page you will be working on. |
+ |
+In most cases you write ordinary module code that goes into the main area in the middle. Then you can place any HTML/JavaScript/whatever code in your templates but surround it with the tag <div class="bitmain">, which will look like this: |
+{code} |
+<div class="bitmain"> |
+ <!-- your HTML here --> |
+</dov> |
+{/code} |
+Or you might be creating a module, in which case it is displayed either in the left or right column. In that case surreund your HTML with <div class="bitmodule"> as shown: |
+{code} |
+<div class="bitmodule"> |
+ <!-- your HTML here --> |
+</dov> |
+{/code} |
+Don't use tables to control the position as Bitweaver already takes care for the layout (and that can be changed in the admin menu). If you cannot believe it, read ((Table_vs_Div)). |
+ |
+Of course within the <div> element you can use tables to organise your information. |
+ |
+!!List Views |
+*The Controller |
+*The Template (View) |
+!!Detail Views |
+*The Controller |
+*The Template (View) |
+!!Feedback and Confirmation |
Up to now, the answer is to look at the ((SamplePackage)) and guess.
|
+errors, warnings, message text and confirmation dialogs |
*gBitSystem->setBrowserTitle()
|
*gBitSystem->confirmDialog()
|
!Authorisation Required
|