Quantcast
Channel: Function Library - Sodapop Documentation
Viewing all articles
Browse latest Browse all 30

$sodapop->doShowModule($modData)

$
0
0
doShowModule($modData)  finds out whether or not to show the module on this app. This is ugly and probably needs to be refactored

Parameter: $modData - takes an array of module data.  Expects: $modData

Location: class.sodapop.php

private function doShowModule($modData) {
//  What if there is no handle?  Then we will set the handle to 'home'
if ($this->pageData['handle'] == "") {$this->pageData['handle'] = 'home';}
// Is the current page one that the module is supposed to show up on?
// we compare the current page's handle to the 'pages' field in the module
// to see if it's in there
$isItThisPage = strpos("_" . $modData['pages'], $this->pageData['handle']);
// Is the current page one that the module us supposed to be hidden from?
// we compare the current pages's name to the 'hidden' field in the module
// to see if it's in there
$hideOnThisPage = strpos("_" . $modData['hidden'], $this->pageData['handle']);
// if the module is assigned to all apps ('apps' field is blank) and the module 
// is not hidden from this app, then we can show the module.
if (($modData['pages'] == '') && ($hideOnThisPage === false)) {

$showIt = true;
}

// If it the module is assigned to this app, then we can show the module
else if ($isItThisPage == true ) {

$showIt = true;
// unless it's explicitly hidden from this app, then we won't show it.
if ($hideOnThisPage == true) {

$showIt = false;
}
// Is the module set to active?  If not, then lets hide it.
$isItActive = $modData['active'];
if ($isItActive == '0') {
$showIt = false;
}
return $showIt;
}

Viewing all articles
Browse latest Browse all 30

Trending Articles