Skip to content

Commit

Permalink
- Script to automatically update the lbd logo: https://www.labdoo.org…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosgiralt committed Apr 24, 2016
1 parent dd9c1d5 commit c83f263
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/labdoo-queries.org
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,11 @@ The following are some of the most commonly used drush queries.
# drush php-eval "lbd_communicate_pop_email_cache(0);" # pops the top element
#+END_EXAMPLE

- To update the Labdoo logo (the small logo located at the upper left part of each Labdoo page):

#+BEGIN_EXAMPLE
# Modify first the png file in lbd-set-logo.php to point to the new logo file, then run:
# drush @lbd php-script /var/www/lbd/profiles/labdoo/utils/lbd-set-logo.php
#+END_EXAMPLE


Binary file added files/pictures/labdoo-site-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions modules/custom/lbd_wiki/lbd_wiki.module
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,32 @@ function lbd_wiki_block_view($delta = '') {
$code = $code . t("<strong><font color='red'>Continue reading under this section:</font></strong>");
$code = $code . "<hr/>";
}
else {
// This node has no children, make it's next node (if any) become its child
$loadedNode = node_load($nodeId);
$nextBook = book_next($loadedNode->book);
if($nextBook) {
$nextChild = array();
$nextChild['link'] = array();
$nextChild['link']['link_path'] = $nextBook['link_path'];
$nextChild['link']['link_title'] = $nextBook['link_title'];
$code = $code . "<hr/>";
$code = $code . t("<strong><font color='red'>Continue reading to the next page:</font></strong>");
$code = $code . "<hr/>";
$code = $code . _process_child($nextChild, $nodeId, 1);
}
$prevBook = book_prev($loadedNode->book);
if($prevBook) {
$prevChild = array();
$prevChild['link'] = array();
$prevChild['link']['link_path'] = $prevBook['link_path'];
$prevChild['link']['link_title'] = $prevBook['link_title'];
$code = $code . "<hr/>";
$code = $code . t("<strong><font color='red'>Go back to read the previous page:</font></strong>");
$code = $code . "<hr/>";
$code = $code . _process_child($prevChild, $nodeId, 1);
}
}
}
else {
$code = $code . "<hr/>";
Expand Down Expand Up @@ -238,6 +264,8 @@ function lbd_wiki_block_view($delta = '') {
* A book page child array
* @param integer $nodeId
* The ID of the node currently being visited
* @param integer $level
* The level of the node in its tree
*
*/
function _process_child($child, $nodeId, $level) {
Expand Down
17 changes: 17 additions & 0 deletions utils/lbd-set-logo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

//
// This script allows you to change the site logo image.
// Run it using:
// $ drush @lbd php-script lbd-set-logo.php
//

$theme_name = 'bootstrap1';
$var_name = 'theme_' . $theme_name . '_settings';
$settings = variable_get($var_name, array());
// Set here the site logo image
$settings['logo_path'] = 'profiles/labdoo/files/pictures/labdoo-site-logo.png';
variable_set($var_name, $settings);

?>

0 comments on commit c83f263

Please sign in to comment.