Changeset 1941

Show
Ignore:
Timestamp:
2006-02-02 16:33:24 (3 years ago)
Author:
ctford
Message:

*Output clips in a pretty themed table.
*Make sure case where end is not defined doesn't break insert.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Anode/trunk/acidfree/class_annodex.inc

    r1940 r1941  
    207207                $result = db_query("SELECT * FROM {acidfree_cmml_clips} WHERE nid={$node->nid} ORDER BY `start`;");      
    208208 
     209                /* Output clip information in a themed table. */ 
     210                $table_rows = array(); 
     211                $header = array(); 
     212 
    209213                while( $row = db_fetch_object($result) ) { 
     214 
     215                        $cells = array(); 
     216 
     217                        $cells[] = array('data'=>l($row->id, "node/{$node->nid}",NULL,"$arg_name=annodex&id={$row->id}")."<br />"); 
    210218                        if( $row->img ) { 
    211                                 $output .= "<a href =\"?q=node/{$node->nid}&$arg_name=annodex&id={$row->id}\"><img height=120 width=120 src=\"{$row->img}\"></a>"; 
     219                                $cells[] = array('data'=>"<a href =\"?q=node/{$node->nid}&$arg_name=annodex&id={$row->id}\"><img height=120 width=120 src=\"{$row->img}\"></a>"); 
     220                        } else { 
     221                                $cells[] = array('data'=>NULL); 
    212222                        } 
    213                         $output .= l($row->id, "node/{$node->nid}",NULL,"$arg_name=annodex&id={$row->id}")."<br />"; 
    214                 } 
     223 
     224                        if( $row->desc ) { 
     225                                $cells[] = array('data'=>$row->desc); 
     226                        } else { 
     227                                $cells[] = array('data'=>NULL); 
     228                        } 
     229 
     230                        /* Add cells */ 
     231                        $table_rows[] = $cells; 
     232                } 
     233                /* Add table */ 
     234                $output .= theme_table( $header, $table_rows ); 
    215235 
    216236                /* Add new clip form */ 
     
    248268 
    249269                if( $occurances == 0 ) { 
    250                         $result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', $start, {$attributes['end']},'{$attributes['id']}', '{$attributes['track']}');");                
     270                        $result = db_query("INSERT INTO {acidfree_cmml_clips} (`nid`, `a_href`, `a_text`, `img`, `desc`, `start`, `end`, `id`, `track`) VALUES('{$node->nid}', '{$attributes['a_href']}', '{$attributes['a_text']}', '{$attributes['img']}', '{$attributes['desc']}', $start, ".(float)$attributes['end'].",'{$attributes['id']}', '{$attributes['track']}');");               
    251271                } else { 
    252272                        $result = db_query("UPDATE {acidfree_cmml_clips} SET `nid` = '{$node->nid}', `a_href` = '{$attributes['a_href']}', `a_text` = '{$attributes['a_text']}', `img` = '{$attributes['img']}', `desc` = '{$attributes['desc']}', `start` = '$start', `end` = '{$attributes['end']}', `id` = '{$attributes['id']}', `track` = '{$attributes['track']}' WHERE `id` = '{$attributes['id']}';");