Modules

Widget_Comment
extends Widget
extends Gleez_Widget

Widget base class

All widgets should extend this class.

package
Gleez\Widget
author
Sandeep Sangamreddi - Gleez
copyright
© 2011-2013 Gleez Technologies
license
http://gleezcms.org/license

Class declared in MODPATH/gleez/classes/widget/comment.php on line 3.

Properties

protected Widget $name

Name

protected Widget $widget

Object

Methods

public delete( ) (defined in Widget_Comment)

Source Code

public function delete( array $post )
{
}

public form( ) (defined in Widget_Comment)

Source Code

public function form()
{
}

public info( ) (defined in Widget_Comment)

Source Code

public function info()
{
}

public recent( ) (defined in Widget_Comment)

Source Code

public function recent($widget)
{
        // Dont show the widget on edit or delete actions.
quest::current()->action() == 'edit' OR Request::current()->action() == 'delete' )
n false;

 = Cache::instance('widgets');

$comments = $cache->get('recent_comments') )

s = ORM::factory('comment')
oin('posts')
on('posts.id', '=', 'comment.post_id')
here('comment.status', '=', 'publish')
here('posts.status', '=', 'publish')
rder_by('comment.created', 'DESC')
imit(10)
ind_all();

ents = array();
ch($blogs as $blog)

ments[$blog->id]['id'] = $blog->id;
ments[$blog->id]['type'] = $blog->type;
ments[$blog->id]['title'] = $blog->title;
ments[$blog->id]['post_url'] = $blog->post->url;
omments[$blog->id] = (object)$blog->as_array();


 the cache
e->set('recent_comments', $comments, DATE::HOUR);


 View::factory('widgets/comment/list')->set('comments', $comments);
}

public render( ) (defined in Widget_Comment)

Source Code

public function render()
{
	switch($this->name)
               {
                       case 'recent':
                               return $this->recent($this->widget);
                       break;
                       default:
                               return;
               }
}

public save( ) (defined in Widget_Comment)

Source Code

public function save( array $post )
{
}

public __construct( ) (defined in Gleez_Widget)

Source Code

public function __construct($name, $widget)
{
	$this->name   = $name;
	$this->widget = $widget;
}

public __toString( ) (defined in Gleez_Widget)

Source Code

public function __toString()
{
	return $this->render();
}

public static factory( string $name , widget $widget ) (defined in Gleez_Widget)

Create a new widget instance

$widget = Widget::factory($name);

Parameters

  • string $name required - Widget name
  • widget $widget required - Widget object

Return Values

  • Widget

Source Code

public static function factory($name, $widget)
{
	// get class name if it has slash for multiple widgets, ex menu/managemnet or static/donate
	$split_name = explode('/', $name);
	$name = array_shift($split_name);

	// Set class name
	$widget_class = 'Widget_'.ucfirst($name);
	$name = isset( $split_name[0] ) ? $split_name[0] : $name ;
	
	return new $widget_class($name, $widget);
}
Documentation comments powered by Disqus