Example #1
0
 /**
  * Create a page panel
  *
  * @param mixed $paginator \MUtil_Ra::args() for an \MUtil_Html_Sequence
  * @param mixed $request
  * @param mixed $args
  * @return self
  */
 public static function pagePanel($paginator = null, $request = null, $args = null)
 {
     $args = func_get_args();
     $pager = new self($args);
     $pager[] = $pager->pageLinks();
     $pager->div($pager->uptoOffDynamic(), array('style' => 'float: right;'));
     return $pager;
 }
Example #2
0
 /**
  * Wraps/nests an $el as specified by $opts 
  * @param stringable|array $el - text or dom element or array of elements to be wrapped
  *   if array, entire array nested / wrapped as specified by $opts
  * Example: $this->nest(['<h2>Simple Text</h2>','<h3>H3 Header</h3>'],'section');
  * @param string|array $opts - simplest, if just string, wrap $el
  * Example: $tpp->wrap('Simple Text','section')=>"<div class'section'>Simple Text</div>"
  * in a div of class $opts -
  * if $opts array, might have 'tag' key - the rest are html attributes
  * Example: $opts = ['tag'=>'h2', 'class'=>'site-header',...]
  *   return "<h2 class='site-header'>$el</h2>"
  * 
  */
 public function nest($el, $opts = [])
 {
     $ret = new self();
     if (is_simple($opts)) {
         //return $ret->div($el,$opts);
         $ret->div($el, $opts);
         return $ret;
     }
     if (is_array($opts)) {
         $tag = keyVal('tag', $opts, 'div');
         unset($opts['tag']);
         //return $ret->$tag($el, $opts);
         $ret->{$tag}($el, $opts);
         return $ret;
     }
     throw new \Exception("Invalid argument for OPTS: " . print_r($opts, 1));
 }