]> git.mjollnir.org Git - moodle.git/commitdiff
Adding one new optional parameter to custom_corner functions, used to
authorstronk7 <stronk7>
Mon, 3 Sep 2007 18:57:12 +0000 (18:57 +0000)
committerstronk7 <stronk7>
Mon, 3 Sep 2007 18:57:12 +0000 (18:57 +0000)
apply ids to all the divs used to render corners. Defaults to null, so
those ids won't be added if unespecified.

lib/custom_corners_lib.php

index 5c88c12d1354f25a69d79e1979a60caa24041d34..47bcf641c3f808a145ab48d3ccfd6455b1746e9d 100755 (executable)
  *
  * @param boolean $clearfix, add CLASS "clearfix" to the inner div against collapsing
  * @param boolean $return, return as string or just print it
+ * @param mixed   $idbase, optionally, define one idbase to be added to all the elements in the corners
  */
-function print_custom_corners_start($clearfix=false, $return=false) {
+function print_custom_corners_start($clearfix=false, $return=false, $idbase=null) {
+
+/// Analise if we want ids for the custom corner elements
+    $idbt = '';
+    $idi1 = '';
+    $idi2 = '';
+    $idi3 = '';
+
+    if ($idbase) {
+        $idbt = 'id="' . $idbase . '-bt" ';
+        $idi1 = 'id="' . $idbase . '-i1" ';
+        $idi2 = 'id="' . $idbase . '-i2" ';
+        $idi3 = 'id="' . $idbase . '-i3" ';
+    }
+
+/// Output begins
     $output = '<div class="wrap">'."\n";
-    $output .= '<div class="bt"><div>&nbsp;</div></div>';
+    $output .= '<div '.$idbt.'class="bt"><div>&nbsp;</div></div>';
     $output .= "\n";
-    $output .= '<div class="i1"><div class="i2">';
-    $output .= (!empty($clearfix)) ? '<div class="i3 clearfix">' : '<div class="i3">';
+    $output .= '<div '.$idi1.'class="i1"><div '.$idi2.'class="i2">';
+    $output .= (!empty($clearfix)) ? '<div '.$idi3.'class="i3 clearfix">' : '<div '.$idi3.'class="i3">';
 
     if ($return) {
         return $output;
@@ -34,11 +50,21 @@ function print_custom_corners_start($clearfix=false, $return=false) {
  * Ending part of the surrounding divs for custom corners
  *
  * @param boolean $return, return as string or just print it
+ * @param mixed   $idbase, optionally, define one idbase to be added to all the elements in the corners
  */
-function print_custom_corners_end($return=false) {
+function print_custom_corners_end($return=false, $idbase=null) {
+
+/// Analise if we want ids for the custom corner elements
+    $idbb = '';
+
+    if ($idbase) {
+        $idbb = 'id="' . $idbase . '-bb" ';
+    }
+
+/// Output begins
     $output = '</div></div></div>';
     $output .= "\n";
-    $output .= '<div class="bb"><div>&nbsp;</div></div>'."\n";
+    $output .= '<div '.$idbb.'class="bb"><div>&nbsp;</div></div>'."\n";
     $output .= '</div>';
 
     if ($return) {