예제 #1
0
 public function __construct()
 {
     parent::__construct();
     // load widgetkit
     require_once JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit.php';
     $this->widgetkit = Widgetkit::getInstance();
 }
예제 #2
0
 public static function getInstance()
 {
     // add instance, if not exists
     if (!isset(self::$_instance)) {
         self::$_instance = new Widgetkit();
     }
     return self::$_instance;
 }
예제 #3
0
 public function pathWK($resource)
 {
     // load widgetkit
     if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit.php')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit.php';
     }
     $widgetkit = Widgetkit::getInstance();
     return $widgetkit['path']->path($resource);
 }
 public function onPrepareContent(&$article, &$params, $limitstart)
 {
     preg_match_all('#\\[widgetkit id=(\\d+)\\]#', $article->text, $matches);
     if (count($matches[1])) {
         // load widgetkit
         require_once JPATH_ADMINISTRATOR . '/components/com_widgetkit/widgetkit.php';
         // get widgetkit
         $widgetkit = Widgetkit::getInstance();
         // render output
         foreach ($matches[1] as $i => $widget_id) {
             $output = $widgetkit['widget']->render($widget_id);
             $output = $output === false ? "Could not load widget with the id {$widget_id}." : $output;
             $article->text = str_replace($matches[0][$i], $output, $article->text);
         }
     }
     return '';
 }
예제 #5
0
		echo json_encode($data);
	}

	/*
		Function: docopy
			Copy action

		Returns:
			Void
	*/
	public function docopy(){

		if ($id = $this['request']->get('id', 'int')) {
			$this['widget']->copy($id);
		}

		echo $this['template']->render('dashboard');
	}

}

// bind events
$widgetkit = Widgetkit::getInstance();
$widgetkit['event']->bind('site', array($widgetkit['accordion'], 'site'));
$widgetkit['event']->bind('dashboard', array($widgetkit['accordion'], 'dashboard'));
$widgetkit['event']->bind('task:edit_accordion', array($widgetkit['accordion'], 'edit'));
$widgetkit['event']->bind('task:item_accordion', array($widgetkit['accordion'], 'item'));
$widgetkit['event']->bind('task:save_accordion', array($widgetkit['accordion'], 'save'));
$widgetkit['event']->bind('task:delete_accordion', array($widgetkit['accordion'], 'delete'));
$widgetkit['event']->bind('task:copy_accordion', array($widgetkit['accordion'], 'docopy'));
 public function __construct()
 {
     // init vars
     $this->widgetkit = Widgetkit::getInstance();
     $this->type = strtolower(str_replace('Joomla', '', get_class($this)));
     $this->options = $this->widgetkit['system']->options;
     // bind events
     $this->widgetkit['event']->bind('dashboard', array($this, 'dashboard'));
     $this->widgetkit['event']->bind("render", array($this, 'render'));
     $this->widgetkit['event']->bind("task:edit_{$this->type}_joomla", array($this, 'edit'));
     $this->widgetkit['event']->bind("task:save_{$this->type}_joomla", array($this, 'save'));
     // register path
     $this->widgetkit['path']->register($this->widgetkit['path']->path('widgetkit_joomla.widgets:' . $this->type), "joomla{$this->type}");
 }
예제 #7
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     // get widgetkit
     $widgetkit = Widgetkit::getInstance();
     return $widgetkit['field']->render('widget', $control_name . '[' . $name . ']', $value, null);
 }
예제 #8
0
 public function __construct()
 {
     parent::__construct(false, 'Widgetkit - Twitter', array('description' => 'Lets you display your tweets'));
     // get widgetkit
     $this->widgetkit = Widgetkit::getInstance();
 }
예제 #9
0
 public function __construct($id, $type, $style, $name, $content, $created, $modified)
 {
     $widgetkit = Widgetkit::getInstance();
     // init vars
     $this->id = $id;
     $this->type = $type;
     $this->name = $name;
     $this->content = $widgetkit['data']->create($content);
     $this->created = $created;
     $this->modified = $modified;
     if (is_null($style)) {
         $settings = $this->content->get("settings", array());
         $style = isset($settings["style"]) ? $settings["style"] : null;
     }
     if (is_null($style) || !$widgetkit["path"]->path("widgets:" . $this->type . "/styles/{$style}/config.xml")) {
         $style = $widgetkit["widget"]->defaultStyle($this->type);
     }
     $this->style = $style;
 }
예제 #10
0
파일: widget.php 프로젝트: ziyou-liu/1line
 function getInput()
 {
     // get widgetkit
     $widgetkit = Widgetkit::getInstance();
     return $widgetkit['field']->render('widget', $this->name, $this->value, null);
 }
예제 #11
0
 public function __construct($id, $type, $style, $name, $content, $created, $modified)
 {
     $widgetkit = Widgetkit::getInstance();
     // init vars
     $this->id = $id;
     $this->type = $type;
     $this->name = $name;
     $this->content = $widgetkit["data"]->create($content);
     $this->created = $created;
     $this->modified = $modified;
 }