Xataface 2.0
Xataface Application Framework
Dataface/GlanceList.php
Go to the documentation of this file.
00001 <?php
00002 class Dataface_GlanceList {
00003 
00004         var $records;
00005         
00006         function Dataface_GlanceList(&$records){
00007         
00008                 $this->records =& $records;
00009                 foreach ( array_keys($this->records) as $key){
00010                         if ( is_a($this->records[$key], 'Dataface_RelatedRecord') ){
00011                                 $this->records[$key] = $this->records[$key]->toRecord();
00012                         }
00013                 }
00014         
00015         }
00016         
00017         function toHtml(){
00018         
00019                 ob_start();
00020                 df_display(array('records'=>&$this->records, 'list'=>&$this), 'Dataface_GlanceList.html');
00021                 $out  = ob_get_contents();
00022                 ob_end_clean();
00023                 return $out;
00024         }
00025         
00026         function oneLineDescription(&$record){
00027                 $del =& $record->_table->getDelegate();
00028                 if ( isset($del) and method_exists($del, 'oneLineDescription') ){
00029                         return $del->oneLineDescription($record);
00030                 }
00031                 
00032                 $app =& Dataface_Application::getInstance();
00033                 $adel =& $app->getDelegate();
00034                 if ( isset($adel) and method_exists($adel, 'oneLineDescription') ){
00035                         return $adel->oneLineDescription($record);
00036                 }
00037                 
00038                 $out = '<span class="Dataface_GlanceList-oneLineDescription">
00039                         <span class="Dataface_GlanceList-oneLineDescription-title"><a href="'.$record->getURL('-action=view').'" title="View this record">'.$record->getTitle().'</a></span> ';
00040                 if ( $creator = $record->getCreator()  ){
00041                         $show = true;
00042                         if ( isset($app->prefs['hide_posted_by']) and $app->prefs['hide_posted_by'] ) $show = false;
00043                         if ( isset($record->_table->_atts['__prefs__']['hide_posted_by']) and $record->_table->_atts['__prefs__']['hide_posted_by'] ) $show = false;
00044                         if ( $show ){
00045                                 $out .=
00046                                 '<span class="Dataface_GlanceList-oneLineDescription-posted-by">Posted by '.$creator.'.</span> ';
00047                         }
00048                 }
00049                 
00050                 if ( $modified = $record->getLastModified() ){
00051                         $show = true;
00052                         if ( isset($app->prefs['hide_updated']) and $app->prefs['hide_updated'] ) $show = false;
00053                         if ( isset($record->_table->_atts['__prefs__']['hide_updated']) and $record->_table->_atts['__prefs__']['hide_updated'] ) $show = false;
00054                         if ( $show ){
00055                                 $out .= '<span class="Dataface_GlanceList-oneLineDescription-updated">Updated '.df_offset(date('Y-m-d H:i:s', $modified)).'</span>';
00056                         }
00057                 }
00058                 $out .= '
00059                         </span>';
00060                 return $out;
00061                 
00062                 
00063         }
00064 }
00065 
 All Data Structures Namespaces Files Functions Variables Enumerations