Show
Ignore:
Timestamp:
05/02/05 15:33:26 (8 years ago)
Author:
fproulx
Message:

2005-05-02 Francois Proulx <francois.proulx@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/Content/PatternLanguage.php

    r601 r610  
    3838class PatternLanguage extends ContentGroup 
    3939{ 
     40    /** 
     41     * Get all pattern language objects 
     42     */ 
     43    public static function getAllContent()  
     44    { 
     45       return parent::getAllContent("PatternLanguage");  
     46    }    
     47      
    4048        function __construct($content_id) 
    4149        { 
     
    4957     * @param $subclass_admin_interface Html content of the interface element of a children 
    5058     * @return The HTML fragment for this interface */ 
    51       
    52      //TODO: complete this 
    53      /* 
    5459    public function getUserUI($subclass_user_interface = null) 
    5560    { 
     
    6368        { 
    6469            // hyperlink to all users narrative 
     70            $html .= "<ul class='pattern_language_menu'>"; 
     71            $html .= "<li><a class='pattern_language_big_links' href='/content/PatternLanguage/subscription.php'>"._("Subscribe to Pattern Language")."</a></li>"; 
     72            $html .= "<li><a class='pattern_language_big_links' href='/content/PatternLanguage/archives.php'>"._("Read narratives archives")."</a></li>"; 
     73            $html .= "</ul>"; 
    6574             
    6675            // Until subscription is done DO NOT log this ! 
     
    7382            // The user is subscribed to the pattern language show an element ! 
    7483            // hyperlink to user's narrative 
     84            $html .= "<ul class='pattern_language_menu'>"; 
     85            $html .= "<li><a href='/content/PatternLanguage/narrative.php'>"._("Read my narrative")."</a></li>"; 
     86            $html .= "<li><a href='/content/PatternLanguage/archives.php'>"._("Read narratives archives")."</a></li>"; 
     87            $html .= "<li><a href='/content/PatternLanguage/subscription.php'>"._("Unsubscribe")."</a></li>"; 
     88            $html .= "</ul>"; 
    7589             
    7690            // Display the random pattern 
     
    8296         
    8397        return $parent_output; 
    84     }*/ 
     98    } 
     99     
     100    /** Is this pattern displayable at a certain Node 
     101     * @param $node Node, optionnal 
     102     * @return true or false */ 
     103    public function isDisplayableAt($node) 
     104    { 
     105        // Pattern language will always be displayable  
     106        return true; 
     107    } 
    85108 
    86109        /** Display the narrative 
     
    89112        public function displayNarrative(User $user) 
    90113        { 
    91                 return "<h1>displayNarrative(): WRITEME</h1>"; 
    92         } 
     114        global $db; 
     115        $sql = "SELECT content_group_element_id FROM content_display_log AS cdl JOIN content_group_element AS cge ON (cdl.content_id = cge.content_group_element_id) WHERE cge.content_group_id = '{$this->getId()}'"; 
     116        $db->ExecSql($sql, $rows, false); 
     117        $html = ""; 
     118        if($rows) 
     119            foreach($rows as $row) 
     120            { 
     121                $cge = Content::getObject($row['content_group_element_id']); 
     122                $html .= $cge->getUserUI()."<p>"; 
     123            }  
     124           return $html; 
     125    } 
    93126         
    94127        /** Get the list of all narratives 
    95          * @param $user The user who's narrative you want to grab 
    96128         * @return the archive page HTML */ 
    97129        public function getNarrativeList() 
    98130        { 
    99                 return "<h1>displayNarrative(): WRITEME</h1>"; 
     131                global $db; 
     132        $sql = "SELECT DISTINCT user_id FROM content_display_log AS cdl JOIN content_group_element AS cge ON (cdl.content_id = cge.content_group_element_id) JOIN content ON (content.content_id = cge.content_group_id) WHERE content_type = 'PatternLanguage'"; 
     133        $db->ExecSql($sql , $rows, false); 
     134        $narratives = array(); 
     135        if($rows) 
     136            foreach($rows as $row) 
     137                $narratives[] = User::getObject($row['user_id']); 
     138        return $narratives; 
    100139        } 
    101140