CMS  Version 3.9
connectable_summary.inc
Go to the documentation of this file.
1 <?php
7 Fakoli::using("connectable");
8 
10 {
11  var $source;
12  var $class;
13  var $showEmpty = false;
14 
15  function __construct($source, $class = "connectable_summary")
16  {
17  $this->id = $id;
18  $this->title = $title;
19  $this->source = $source;
20  $this->class = $class;
21  }
22 
23  function drawTarget($target)
24  {
25  trace("Drawing target: $target for source ".get_class($this->source), 3);
26 
27  $obj = new $target;
28  $name = $obj->prettifyClassName(true);
29  $icon = $obj->getConnectableIcon();
30 
31  $count = ConnectableManager::getConnectedItemCount($this->source, $target, $obj->getConnectableConstraint());
32  if (!$count && !$this->showEmpty) return;
33 ?>
34  <li><img src="<?echo $icon?>" alt="<?echo $name?>" title="<?echo $name?>" data-count="<?echo $count?>"/></li>
35 <?
36  }
37 
38  function draw()
39  {
41 
42 ?>
43 <ul class="<?echo $this->class?>">
44 <?
45  foreach($targets as $target)
46  {
47  $this->drawTarget($target);
48  }
49 ?>
50 </ul>
51 <?
52  }
53 }?>
$name
Definition: upload.inc:54
$icon
Definition: upload.inc:92
$bookmark title
static getConnectedItemCount($sourceItem, $targetClass, $constraint="")
Returns the number of connected items for the specified source that are of the specified class.
static getTargetClasses($sourceItem)
Return an array of connectable target classes for the specified item.
__construct($source, $class="connectable_summary")
static using()
Import the datamodels, views and manifest for the specified component(s).
Definition: core.inc:116