| 8 |
* An array of regions. The first array element will be used as the default region for themes. |
* An array of regions. The first array element will be used as the default region for themes. |
| 9 |
* Each array element takes the format: variable_name => t('human readable name') |
* Each array element takes the format: variable_name => t('human readable name') |
| 10 |
*/ |
*/ |
| 11 |
|
function Amor_Azul_regions() { |
| 12 |
|
return array( |
| 13 |
|
'top_menu' => t('top menu'), |
| 14 |
|
'header_image' => t('header image'), |
| 15 |
|
'header_text' => t('header text'), |
| 16 |
|
'content_top' => t('content top'), |
| 17 |
|
'sidebar_left' => t('sidebar left'), |
| 18 |
|
'sidebar_right' => t('sidebar right'), |
| 19 |
|
'content_bottom' => t('content bottom'), |
| 20 |
|
'footer_links' => t('footer_links') |
| 21 |
|
); |
| 22 |
|
} |
| 23 |
|
|
| 24 |
/** |
/** |
| 25 |
* Adjust content width according to the absence or presence of sidebars. |
* Adjust content width according to the absence or presence of sidebars. |
| 27 |
* If only one sidebar is active, the mainContent width will expand to fill |
* If only one sidebar is active, the mainContent width will expand to fill |
| 28 |
* the space of the missing sidebar. |
* the space of the missing sidebar. |
| 29 |
*/ |
*/ |
| 30 |
function Amor_Azul_get_mainContent_width($left, $right) { |
function Amor_Azul_get_mainContent_width($sidebar_left, $sidebar_right) { |
| 31 |
$width = 430; |
$width = 430; |
| 32 |
if (!$left || arg(0)=='admin') { |
if (!$sidebar_left || arg(0)=='admin') { |
| 33 |
$width = $width + 180; |
$width = $width + 180; |
| 34 |
} |
} |
| 35 |
if (!$right) { |
if (!$sidebar_right) { |
| 36 |
$width = $width + 180; |
$width = $width + 180; |
| 37 |
} |
} |
| 38 |
return $width; |
return $width; |
| 39 |
} |
} |
| 40 |
function Amor_Azul_get_sideBars_width($left, $right) { |
function Amor_Azul_get_sideBars_width($sidebar_left, $sidebar_right) { |
| 41 |
$width = 415; |
$width = 415; |
| 42 |
if (!$left || arg(0)=='admin') { |
if (!$sidebar_left || arg(0)=='admin') { |
| 43 |
$width = $width - 205; |
$width = $width - 205; |
| 44 |
} |
} |
| 45 |
if (!$right) { |
if (!$sidebar_right) { |
| 46 |
$width = $width - 205; |
$width = $width - 205; |
| 47 |
} |
} |
| 48 |
return $width; |
return $width; |
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
function get_link($menu_path) |
| 214 |
|
{ |
| 215 |
|
if($menu_path=='-') |
| 216 |
|
{ |
| 217 |
|
$return = '#'; |
| 218 |
|
} |
| 219 |
|
else |
| 220 |
|
{ |
| 221 |
|
global $base_url; |
| 222 |
|
$menu_path = trim($menu_path); |
| 223 |
|
$db_links = "select * from url_alias where src='".$menu_path."'"; |
| 224 |
|
$rs_links = db_query($db_links); |
| 225 |
|
if(db_num_rows($rs_links)>0) |
| 226 |
|
{ |
| 227 |
|
$row_links = db_fetch_object($rs_links); |
| 228 |
|
$return = $base_url.'/'.$row_links->dst; |
| 229 |
|
}else |
| 230 |
|
{ |
| 231 |
|
if($menu_path=='<front>') |
| 232 |
|
{ |
| 233 |
|
$return = $base_url.'/'; |
| 234 |
|
}elseif(strstr($menu_path,'http://')) |
| 235 |
|
{ |
| 236 |
|
$return = $menu_path; |
| 237 |
|
} |
| 238 |
|
else |
| 239 |
|
{ |
| 240 |
|
$return = $base_url.'/'.$menu_path; |
| 241 |
|
} |
| 242 |
|
} |
| 243 |
|
} |
| 244 |
|
return $return; |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
function _get_class(&$node,$path) |
| 248 |
|
{ |
| 249 |
|
$return = 'sub'; |
| 250 |
|
/* print 'Node: '.$node; |
| 251 |
|
print '<br>'; |
| 252 |
|
print 'Node Path: '.$node->path; |
| 253 |
|
print '<br>'; |
| 254 |
|
print 'Menu Path: '.$path.'<hr>'; |
| 255 |
|
*/ |
| 256 |
|
if($node->path == trim($path) || (($path == '<front>' || $path == 'node/1') && !$node) && arg(0) != 'image') |
| 257 |
|
{ |
| 258 |
|
$return = 'current'; |
| 259 |
|
}else if(trim('node/'.$node->nid) == trim($path)) |
| 260 |
|
{ |
| 261 |
|
$return = 'current'; |
| 262 |
|
}else if(trim($path) == 'image' && !$node && arg(0) == 'image') |
| 263 |
|
{ |
| 264 |
|
$return = 'current'; |
| 265 |
|
} |
| 266 |
|
return $return; |
| 267 |
|
} |
| 268 |
|
|
| 269 |
|
function _get_second_leval($parent_id,$menu_type) |
| 270 |
|
{ |
| 271 |
|
$all_menu_1 = ''; |
| 272 |
|
$db_main_menu_1 = "select * from {menu} where pid=".$parent_id." and type IN (".$menu_type.") order by weight"; |
| 273 |
|
$rs_main_menu_1 = db_query($db_main_menu_1); |
| 274 |
|
if(db_num_rows($rs_main_menu_1)>0) |
| 275 |
|
{ |
| 276 |
|
$all_menu_1 .= '<ul>'; |
| 277 |
|
while($row_main_menu_1 = db_fetch_object($rs_main_menu_1)) |
| 278 |
|
{ |
| 279 |
|
$all_menu_1 .= '<li>'; |
| 280 |
|
if(strstr($row_main_menu_1->path,'http://')) |
| 281 |
|
{ |
| 282 |
|
$all_menu_1 .= '<a href="'.get_link($row_main_menu_1->path).'" target="_blank" title="'.$row_main_menu_1->description.'">'.$row_main_menu_1->title.'</a>'; |
| 283 |
|
} |
| 284 |
|
else |
| 285 |
|
{ |
| 286 |
|
$all_menu_1 .= '<a href="'.get_link($row_main_menu_1->path).'" title="'.$row_main_menu_1->description.'">'.$row_main_menu_1->title.'</a>'; |
| 287 |
|
} |
| 288 |
|
$all_menu_1 .= '</li>'; |
| 289 |
|
} |
| 290 |
|
$all_menu_1 .= '</ul>'; |
| 291 |
|
} |
| 292 |
|
return $all_menu_1; |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
function _get_menus($parent_id,$menu_type, $node = '<front>') |
| 296 |
|
{ |
| 297 |
|
$menu_type = explode("|",$menu_type); |
| 298 |
|
$menu_type = implode(",",$menu_type); |
| 299 |
|
$all_menu = ''; |
| 300 |
|
$db_main_menu = "select * from {menu} where pid=".$parent_id." and type IN (".$menu_type.") order by weight"; |
| 301 |
|
$rs_main_menu = db_query($db_main_menu); |
| 302 |
|
if(db_num_rows($rs_main_menu)>0) |
| 303 |
|
{ |
| 304 |
|
while($row_main_menu = db_fetch_object($rs_main_menu)) |
| 305 |
|
{ |
| 306 |
|
$all_menu .= '<li class="top">'; |
| 307 |
|
$class = _get_class($node,$row_main_menu->path); |
| 308 |
|
if(strstr($row_main_menu->path,'http://')) |
| 309 |
|
{ |
| 310 |
|
$all_menu .= '<a href="'.get_link($row_main_menu->path).'" target="_blank" title="'.$row_main_menu->description.'" class="top_link"><span>'.$row_main_menu->title.'</span><!--[if IE 7]><!--></a><!--<![endif]-->'; |
| 311 |
|
} |
| 312 |
|
else |
| 313 |
|
{ |
| 314 |
|
$all_menu .= '<a href="'.get_link($row_main_menu->path).'" title="'.$row_main_menu->description.'" class="top_link"><span>'.$row_main_menu->title.'</span><!--[if IE 7]><!--></a><!--<![endif]-->'; |
| 315 |
|
} |
| 316 |
|
$all_menu .= '<!--[if lte IE 6]><table><tr><td><![endif]-->'; |
| 317 |
|
$all_menu .= _get_second_leval($row_main_menu->mid,$menu_type); |
| 318 |
|
$all_menu .= '<!--[if lte IE 6]></td></tr></table></a><![endif]-->'; |
| 319 |
|
$all_menu .= '</li>'; |
| 320 |
|
} |
| 321 |
|
} |
| 322 |
|
return $all_menu; |
| 323 |
|
} |
| 324 |
if(check_block(3,'Amor_Azul')) |
if(check_block(3,'Amor_Azul')) |
| 325 |
{ |
{ |
| 326 |
db_query( |
db_query( |
| 407 |
function check_block($bid,$theme) |
function check_block($bid,$theme) |
| 408 |
{ |
{ |
| 409 |
$result = db_query("SELECT * FROM {blocks} WHERE delta = %d and theme = '%s' and module = 'block'", $bid, $theme); |
$result = db_query("SELECT * FROM {blocks} WHERE delta = %d and theme = '%s' and module = 'block'", $bid, $theme); |
| 410 |
if(db_result($result)>0) |
if(db_num_rows($result)>0) |
| 411 |
{ |
{ |
| 412 |
return false; |
return false; |
| 413 |
} |
} |
| 415 |
{ |
{ |
| 416 |
return true; |
return true; |
| 417 |
} |
} |
|
} |
|
|
|
|
|
function _get_menus($menu_name, $node = '<front>') |
|
|
{ |
|
|
// $menu_type = explode("|",$menu_type); |
|
|
// $menu_type = implode(",",$menu_type); |
|
|
// $all_menu = ''; |
|
|
$db_main_menu = "SELECT * from {menu_links} where menu_name='".$menu_name."' order by weight"; |
|
|
$rs_main_menu = db_query($db_main_menu); |
|
|
while($row_main_menu = db_fetch_object($rs_main_menu)) |
|
|
{ |
|
|
|
|
|
$all_menu .= '<li class="top">'; |
|
|
$class = _get_class($node,$row_main_menu->link_path); |
|
|
if(strstr($row_main_menu->link_path,'http://')) |
|
|
{ |
|
|
$all_menu .= '<a href="'.get_link($row_main_menu->link_path).'" target="_blank" title="'.$row_main_menu->link_title.'" class="top_link"><span>'.$row_main_menu->link_title.'</span><!--[if IE 7]><!--></a><!--<![endif]-->'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
$all_menu .= '<a href="'.get_link($row_main_menu->link_path).'" title="'.$row_main_menu->link_title.'" class="top_link"><span>'.$row_main_menu->link_title.'</span><!--[if IE 7]><!--></a><!--<![endif]-->'; |
|
|
} |
|
|
$all_menu .= '<!--[if lte IE 6]><table><tr><td><![endif]-->'; |
|
|
//$all_menu .= _get_second_leval($row_main_menu->mid,$menu_type); |
|
|
$all_menu .= '<!--[if lte IE 6]></td></tr></table></a><![endif]-->'; |
|
|
$all_menu .= '</li>'; |
|
|
} |
|
|
return $all_menu; |
|
|
} |
|
|
function _get_class(&$node,$path) |
|
|
{ |
|
|
$return = 'sub'; |
|
|
if($node->path == trim($path) || (($path == '<front>' || $path == 'node/1') && !$node) && arg(0) != 'image') |
|
|
{ |
|
|
$return = 'current'; |
|
|
}else if(trim('node/'.$node->nid) == trim($path)) |
|
|
{ |
|
|
$return = 'current'; |
|
|
}else if(trim($path) == 'image' && !$node && arg(0) == 'image') |
|
|
{ |
|
|
$return = 'current'; |
|
|
} |
|
|
return $return; |
|
|
} |
|
|
function get_link($menu_path) |
|
|
{ |
|
|
if($menu_path=='-') |
|
|
{ |
|
|
$return = '#'; |
|
|
} |
|
|
else |
|
|
{ |
|
|
global $base_url; |
|
|
$menu_path = trim($menu_path); |
|
|
$db_links = "select * from url_alias where src='".$menu_path."'"; |
|
|
$rs_links = db_query($db_links); |
|
|
if(db_result($rs_links)>0) |
|
|
{ |
|
|
$row_links = db_fetch_object($rs_links); |
|
|
$return = $base_url.'/'.$row_links->dst; |
|
|
}else |
|
|
{ |
|
|
if($menu_path=='<front>') |
|
|
{ |
|
|
$return = $base_url.'/'; |
|
|
}elseif(strstr($menu_path,'http://')) |
|
|
{ |
|
|
$return = $menu_path; |
|
|
} |
|
|
else |
|
|
{ |
|
|
$return = $base_url.'/'.$menu_path; |
|
|
} |
|
|
} |
|
|
} |
|
|
return $return; |
|
| 418 |
} |
} |