Modified the moldule class, content scripts and styling to extent the module function...
authorcindy li <cli@ocad.ca>
Wed, 8 Dec 2010 15:31:03 +0000 (15:31 -0000)
committercindy li <cli@ocad.ca>
Wed, 8 Dec 2010 15:31:03 +0000 (15:31 -0000)
docs/content.php
docs/mods/_core/modules/classes/Module.class.php
docs/themes/default/content.tmpl.php
docs/themes/default/styles.css
docs/themes/mobile/android.css
docs/themes/mobile/blackberry.css
docs/themes/mobile/iphone.css

index 48fd62b..0af59fe 100644 (file)
@@ -248,6 +248,20 @@ if ($released_status === TRUE || authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN))
                                $savant->assign('forum_message', '');
                                $savant->assign('forum_ids', array());
                        }
+
+                       // get the content that the standard and add-on modules want to display on the content page
+                       $module_status_bits = AT_MODULE_STATUS_ENABLED;
+                       $module_type_bits = AT_MODULE_TYPE_STANDARD + AT_MODULE_TYPE_EXTRA;
+                       
+                       $module_list = $moduleFactory->getModules($module_status_bits, $module_type_bits, $sort = TRUE);
+                       $module_contents = '';
+                       foreach($module_list as $key=>$obj) {
+                               $module_content = $obj->getContent();
+                               if (!empty($module_content)){
+                                       $module_contents .= '<div id="'.str_replace('/', '-', $key).'" class="content-from-module">'.$module_content.'</div>';
+                               }
+                       }
+                       if ($module_contents <> '') $savant->assign('module_contents', $module_contents);
                }       
        }
 } else {
index 8afac0a..1046c1a 100644 (file)
@@ -220,7 +220,7 @@ class Module {
 
        function load() {
                if (is_file(AT_MODULE_PATH . $this->_directoryName.'/module.php')) {
-                       global $_modules, $_pages, $_stacks, $_list, $_tool, $_content_tools;  // $_list is for sublinks on "detail view"
+                       global $_modules, $_pages, $_stacks, $_list, $_tool, $_content_tools, $_callbacks;  // $_list is for sublinks on "detail view"
 
                        require(AT_MODULE_PATH . $this->_directoryName.'/module.php');
 
@@ -243,6 +243,10 @@ class Module {
                                $_content_tools = array_merge((array)$_content_tools, $this->_content_tools);                   
                        }
                        
+                       if(isset($this->_callbacks)) {
+                               $_callbacks = array_merge((array)$_callbacks, $this->_callbacks);                       
+                       }
+                       
                        //TODO***********BOLOGNA***********REMOVE ME***********/
                         //tool manager (content editing)
                        if(isset($this->_tool)) {
@@ -668,7 +672,6 @@ class Module {
 
        }
 
-
        /**
         * Get the latest news from the Module. 
         * @access      public
@@ -702,6 +705,25 @@ class Module {
                }
        }
        
+       /**
+        * Get the output that this module wants to add onto content page. 
+        * @access      public
+        * @author      Cindy Li 
+        * @date        Dec 7, 2010
+        */
+       function getContent(){
+               if (file_exists(AT_MODULE_PATH . $this->_directoryName.'/moduleCallbacks.class.php') &&
+                   isset($this->_callbacks[$this->_directoryName])) 
+               {
+                       require(AT_MODULE_PATH . $this->_directoryName.'/moduleCallbacks.class.php');
+                       if (method_exists($this->_callbacks[$this->_directoryName], "appendContent")) {
+                               eval('$output = '.$this->_callbacks[$this->_directoryName]."::appendContent();");
+                               return $output;
+                       }
+               }
+               return NULL;
+       }
+       
        private function convertContent164($course_id) {
                global $db;
                
index 3e5f27d..77c6e34 100644 (file)
@@ -71,6 +71,7 @@ if (!empty($this->forum_ids)): ?>
 </div>\r
 <?php endif; ?>\r
 \r
+<?php if (!empty($this->module_contents)) echo $this->module_contents;?>\r
 \r
 <div id="content-info">\r
        <?php echo $this->content_info; ?>\r
index ef45e0e..c80c099 100644 (file)
@@ -1289,9 +1289,10 @@ div#content-text li {
        margin-left: 15pt;
 }
 
-div#content-test {     
+div#content-test, div.content-from-module {    
        float: left;
        margin-top: 2em;
+       margin-bottom: 2em;
        padding-right: 5pt;
        width: 80%;
 }
index 544c46a..ae21f22 100644 (file)
@@ -1402,9 +1402,10 @@ div#content-text li {
        margin-left: 15pt;
 }
 
-div#content-test {     
+div#content-test, div.content-from-module {    
        float: left;
        margin-top: 2em;
+       margin-bottom: 2em;
        padding-right: 5pt;
        width: 80%;
 }
index 177c382..9d8903d 100644 (file)
@@ -1393,9 +1393,10 @@ div#content-text li {
        margin-left: 15pt;
 }
 
-div#content-test {     
+div#content-test, div.content-from-module {    
        float: left;
        margin-top: 2em;
+       margin-bottom: 2em;
        padding-right: 5pt;
        width: 80%;
 }
index 785e5ca..a2204a6 100644 (file)
@@ -1378,9 +1378,10 @@ div#content-text li {
        margin-left: 15pt;
 }
 
-div#content-test {     
+div#content-test, div.content-from-module {    
        float: left;
        margin-top: 2em;
+       margin-bottom: 2em;
        padding-right: 5pt;
        width: 80%;
 }