Show
Ignore:
Timestamp:
09/27/05 18:56:51 (8 years ago)
Author:
benoitg
Message:

2005-09-27 Benoit Gr�goire <bock@…>

  • Partial login page content manager support (Node only for now)
Files:
1 modified

Legend:

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

    r775 r779  
    955955                $html .= "</div>\n"; 
    956956 
    957                 $html .= "<div class='admin_section_container'>\n"; 
    958                 $html .= "<div class='admin_section_title'>"._("Node content:")."</div>\n"; 
    959  
    960                 $html .= "<ul class='admin_section_list'>\n"; 
    961                 foreach ($this->getAllContent() as $content) 
    962                 { 
    963                         $html .= "<li class='admin_section_list_item'>\n"; 
    964                         $html .= "<div class='admin_section_data'>\n"; 
    965                         $html .= $content->getListUI(); 
    966                         $html .= "</div>\n"; 
    967                         $html .= "<div class='admin_section_tools'>\n"; 
    968                         $name = "node_".$this->id."_content_".$content->GetId()."_edit"; 
    969                         $html .= "<input type='button' name='$name' value='"._("Edit")."' onClick='window.location.href = \"".GENERIC_OBJECT_ADMIN_ABS_HREF."?object_class=Content&action=edit&object_id=".$content->GetId()."\";'>\n"; 
    970                         $name = "node_".$this->id."_content_".$content->GetId()."_erase"; 
    971                         $html .= "<input type='submit' name='$name' value='"._("Remove")."'>"; 
    972                         $html .= "</div>\n"; 
    973                         $html .= "</li>\n"; 
    974                 } 
    975                 $html .= "<li class='admin_section_list_item'>\n"; 
    976                 $name = "node_{$this->id}_new_content"; 
    977                 $html .= Content :: getSelectContentUI($name, "AND content_id NOT IN (SELECT content_id FROM node_has_content WHERE node_id='$this->id')"); 
    978                 $name = "node_{$this->id}_new_content_submit"; 
    979                 $html .= "<input type='submit' name='$name' value='"._("Add")."'>"; 
    980                 $html .= "</li>\n"; 
    981                 $html .= "</ul>\n"; 
     957/* Node content */ 
     958                $html .= "<div class='admin_section_container'>\n"; 
     959                $html .= "<div class='admin_section_title'>"._("Node content (login):")."</div>\n"; 
     960                $name = "node_{$this->id}_content_login"; 
     961$html .= Content::getLinkedContentUI($name, 'node_has_content', 'node_id', $this->id, $display_location = 'login_page'); 
     962                $html .= "</div>\n"; 
     963                 
     964                $html .= "<div class='admin_section_container'>\n"; 
     965                $html .= "<div class='admin_section_title'>"._("Node content (portal):")."</div>\n"; 
     966                $name = "node_{$this->id}_content_portal"; 
     967$html .= Content::getLinkedContentUI($name, 'node_has_content', 'node_id', $this->id, $display_location = 'portal_page'); 
    982968                $html .= "</div>\n"; 
    983969 
     
    11691155 
    11701156                // Content processing  
    1171                 // Rebuild content id and deleting if it was selected for deletion ) 
    1172                 foreach ($this->getAllContent() as $content) 
    1173                 { 
    1174                         $name = "node_".$this->id."_content_".$content->GetId()."_erase"; 
    1175                         if (!empty ($_REQUEST[$name])) 
    1176                         { 
    1177                                 $this->removeContent($content); 
    1178                         } 
    1179                 } 
    1180  
    1181                 $name = "node_{$this->id}_new_content_submit"; 
    1182                 if (!empty ($_REQUEST[$name])) 
    1183                 { 
    1184                         $name = "node_{$this->id}_new_content"; 
    1185                         $content = Content :: processSelectContentUI($name); 
    1186                         if ($content) 
    1187                                 $this->addContent($content); 
    1188                 } 
     1157                $name = "node_{$this->id}_content_login"; 
     1158                Content::processLinkedContentUI($name, 'node_has_content', 'node_id', $this->id); 
     1159                                $name = "node_{$this->id}_content_portal"; 
     1160Content::processLinkedContentUI($name, 'node_has_content', 'node_id', $this->id); 
     1161 
    11891162        } 
    11901163 
     
    12161189         * @param boolean $exclude_subscribed_content 
    12171190        * @param User $subscriber The User object used to discriminate the content 
     1191        * @param $display_location Only select the content to be displayed in thios 
     1192        * area.  Defaults to 'portal_page' 
    12181193        * @return an array of Content or an empty arrray */ 
    1219         function getAllContent($exclude_subscribed_content = false, $subscriber = null) 
     1194        function getAllContent($exclude_subscribed_content = false, $subscriber = null, $display_location='portal_page') 
    12201195        { 
    12211196                global $db; 
     
    12231198                // Get all network, but exclude user subscribed content if asked 
    12241199                if ($exclude_subscribed_content == true && $subscriber) 
    1225                         $sql = "SELECT content_id FROM node_has_content WHERE node_id='{$this->id}' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$subscriber->getId()}') ORDER BY subscribe_timestamp DESC"; 
     1200                        $sql = "SELECT content_id FROM node_has_content WHERE node_id='{$this->id}' AND display_location='$display_location' AND content_id NOT IN (SELECT content_id FROM user_has_content WHERE user_id = '{$subscriber->getId()}') ORDER BY subscribe_timestamp DESC"; 
    12261201                else 
    1227                         $sql = "SELECT content_id FROM node_has_content WHERE node_id='{$this->id}' ORDER BY subscribe_timestamp DESC"; 
     1202                        $sql = "SELECT content_id FROM node_has_content WHERE node_id='{$this->id}' AND display_location='$display_location' ORDER BY subscribe_timestamp DESC"; 
    12281203                $db->ExecSql($sql, $content_rows, false); 
    12291204