Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('_JEXEC') or die;
- ### Joomla Template - Workframe
- ### www.joomla-agentur.de
- ?>
- <?php
- function modChrome_jooag( $module, &$params, &$attribs ){
- //Variablen die benötigt werden
- $doc = JFactory::getDocument();
- $modCountSum = $doc->countModules($attribs['name']);
- $modPosition = $module->position;//$module -> id title name
- $modPerRow = $doc->params->get('modulesPerRow');
- $spanCustom = '';
- $spanOffset = '';
- //Variablen die innerhalb der Funktion gespeichert werden müssen
- static $modCount;
- static $spanMatrix;
- $modCount++;
- //Titel nach [modus_xx] Filtern
- if($modCount == 1){$spanMatrix = array();}
- preg_match_all("/^(.*\[)(.*)(\])/", $module->title, $betweenBrackets);
- if(isset($betweenBrackets[2][0])== false){$betweenBrackets = array ( "2" => array("0" => ' [empty] '));}
- $titleSuffix = explode('|',$betweenBrackets[2][0]);
- foreach($titleSuffix as $options){
- if(preg_match('/preset/',$options) and $modCount == 1){
- $titleGridResult = explode("_",$options);
- $moduleMode = $titleGridResult[0];
- $modGrids = $titleGridResult[1];
- }
- if(preg_match('/span/',$options)){
- $spanCustom = $options;
- }
- if(preg_match('/offset/',$options)){
- $spanOffset = $options;
- }
- }
- if($modCount == 1){
- //Modulaufteilung nach Anzahl
- if($modCountSum > $modPerRow){$newModulesPerRow = $modPerRow;}
- if($modCountSum <= $modPerRow || $modPerRow == 0){$newModulesPerRow = $modCountSum;}
- for($i=1; $i <= $modCountSum; $i++){
- $spanMatrix[$modPosition][$i] = 12 / $newModulesPerRow;
- }
- //Left & Right Calculating
- if($modPosition == 'left' || $modPosition == 'right'){
- for($i=1; $i <= $modCountSum; $i++){
- $spanMatrix[$modPosition][$i] = $doc->params->get($modPosition.'Span');
- }
- }
- //Mode: Preset
- if(isset($moduleMode)){
- $mG = $modGrids.',';
- $modGrids = explode(",",'0,'.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG.$mG);
- for($i=1; $i <= 12; $i++){
- $spanMatrix[$modPosition][$i] = $modGrids[$i];
- }
- }
- //Abrunden
- for($i=1; $i <= $modCountSum; $i++){
- $spanMatrix[$modPosition][$i] = ceil($spanMatrix["$modPosition"][$i]);
- }
- }
- //Module Mode Detection for the reft and right module
- $modDef = array('left','right');
- //AUSGABE MODULE - ALL
- if($modCount == 1 and in_array($modPosition, $modDef) == false){echo '<div class="row'.jooagFluid().' '.$modPosition.'-section">';}
- echo '<div class="span'.$spanMatrix[$modPosition][$modCount].' '.$modPosition.' id'.$modCount.' module '.$params->get('moduleclass_sfx').' '.$spanCustom.' '.$spanOffset.'">';
- if ($module->showtitle){echo '<h4 class="titlestyle"><i></i>'.preg_replace('/\[(.*)\]/','',$module->title).'</h4>';}
- echo $module->content;
- echo '</div>';
- if($modCount == $modCountSum and in_array($modPosition, $modDef) == false){$modCount = 0;echo '</div>';}
- if(in_array($modPosition, $modDef)){$modCount = 0;}
- //NEW row Detection
- $spanSum = '';
- for($i=1; $i <= $modCount; $i++){$spanSum = $spanSum + $spanMatrix[$modPosition][$i];}
- if(($modCount) % 12 == 0 and $modCount != 0){echo '/div><div class="row'.jooagFluid().' '.$modPosition.'-section">';}
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement