/**
  * Get type icon path path
  * Return image path for icon_xxx.pngs
  * Or (if enabled) path to custom icon
  *
  * @access public
  * @param string obj_type
  * @param int obj_id
  * @param string size 'tiny','small' or 'big'
  * @static 
  *
  */
 public static function getTypeIconPath($a_type, $a_obj_id, $a_size = 'small')
 {
     global $ilSetting;
     if ($ilSetting->get("custom_icons")) {
         switch ($a_type) {
             case 'cat':
             case 'crs':
             case 'grp':
                 include_once './Services/Container/classes/class.ilContainer.php';
                 if (strlen($path = ilContainer::_lookupIconPath($a_obj_id, $a_size))) {
                     return $path;
                 }
         }
     }
     switch ($a_size) {
         case 'tiny':
             $postfix = '_s.png';
             break;
         case 'big':
             $postfix = '_b.png';
             break;
         default:
             $postfix = '.png';
             break;
     }
     return ilUtil::getImagePath('icon_' . $a_type . $postfix);
 }
Example #2
0
 /**
  * Get type icon path path
  * Return image path for icon_xxx.pngs
  * Or (if enabled) path to custom icon
  *
  * @access public
  * @param string obj_type
  * @param int obj_id
  * @param string size 'tiny','small' or 'big'
  * @static 
  *
  */
 public static function getTypeIconPath($a_type, $a_obj_id, $a_size = 'small')
 {
     global $ilSetting, $objDefinition;
     if ($ilSetting->get("custom_icons")) {
         switch ($a_type) {
             case 'cat':
             case 'crs':
             case 'grp':
                 include_once './Services/Container/classes/class.ilContainer.php';
                 if (strlen($path = ilContainer::_lookupIconPath($a_obj_id, $a_size))) {
                     return $path;
                 }
         }
     }
     if ($objDefinition->isPluginTypeName($a_type)) {
         $class_name = "il" . $objDefinition->getClassName($a_type) . 'Plugin';
         $location = $objDefinition->getLocation($a_type);
         include_once $location . "/class." . $class_name . ".php";
         return call_user_func(array($class_name, "_getIcon"), $a_type, $a_size, $a_obj_id);
     }
     switch ($a_size) {
         case 'tiny':
             $postfix = '_s.png';
             break;
         case 'big':
             $postfix = '_b.png';
             break;
         default:
             $postfix = '.png';
             break;
     }
     return ilUtil::getImagePath('icon_' . $a_type . $postfix);
 }
 /**
  * adds a standard row to a block template
  *
  * @param	object		$a_tpl		block template
  * @param	string		$a_html		html code
  * @access	private
  */
 function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "", $a_image_type = "", $a_related_header = "")
 {
     global $ilSetting;
     $this->cur_row_type = $this->cur_row_type == "row_type_1" ? "row_type_2" : "row_type_1";
     $a_tpl->touchBlock($this->cur_row_type);
     if ($a_image_type != "") {
         if (!is_array($a_image_type) && !in_array($a_image_type, array("lm", "dbk", "htlm", "sahs"))) {
             $icon = ilUtil::getImagePath("icon_" . $a_image_type . ".png");
             $title = $this->lng->txt("obj_" . $a_image_type);
         } else {
             $icon = ilUtil::getImagePath("icon_lm.png");
             $title = $this->lng->txt("learning_resource");
         }
         // custom icon
         if ($ilSetting->get("custom_icons") && in_array($a_image_type, array("cat", "grp", "crs"))) {
             require_once "./Services/Container/classes/class.ilContainer.php";
             if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "") {
                 $icon = $path;
             }
         }
         $a_tpl->setCurrentBlock("block_row_image");
         $a_tpl->setVariable("ROW_IMG", $icon);
         $a_tpl->setVariable("ROW_ALT", $title);
         $a_tpl->parseCurrentBlock();
     } else {
         $a_tpl->setVariable("ROW_NBSP", " ");
     }
     $a_tpl->setCurrentBlock("container_standard_row");
     $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
     $rel_headers = $a_related_header != "" ? "th_selected_items " . $a_related_header : "th_selected_items";
     $a_tpl->setVariable("BLOCK_ROW_HEADERS", $rel_headers);
     $a_tpl->parseCurrentBlock();
     $a_tpl->touchBlock("container_row");
 }
Example #4
0
 /**
  * adds a standard row to a block template
  *
  * @param	object		$a_tpl		block template
  * @param	string		$a_html		html code
  * @access	private
  */
 function addStandardRow(&$a_tpl, $a_html, $a_item_ref_id = "", $a_item_obj_id = "", $a_image_type = "")
 {
     $this->cur_row_type = $this->cur_row_type == "row_type_1" ? "row_type_2" : "row_type_1";
     $a_tpl->touchBlock($this->cur_row_type);
     $nbsp = true;
     if ($this->ilias->getSetting("icon_position_in_lists") == "item_rows") {
         $icon = ilUtil::getImagePath("icon_" . $a_image_type . ".svg");
         $alt = $this->lng->txt("obj_" . $a_image_type);
         // custom icon
         if ($this->ilias->getSetting("custom_icons") && in_array($a_image_type, array("cat", "grp", "crs"))) {
             require_once "./Services/Container/classes/class.ilContainer.php";
             if (($path = ilContainer::_lookupIconPath($a_item_obj_id, "small")) != "") {
                 $icon = $path;
             }
         }
         $a_tpl->setCurrentBlock("block_row_image");
         $a_tpl->setVariable("ROW_IMG", $icon);
         $a_tpl->setVariable("ROW_ALT", $alt);
         $a_tpl->parseCurrentBlock();
         $nbsp = false;
     }
     if ($this->isActiveAdministrationPanel()) {
         $a_tpl->setCurrentBlock("block_row_check");
         $a_tpl->setVariable("ITEM_ID", $a_item_ref_id);
         $a_tpl->parseCurrentBlock();
         $nbsp = false;
     }
     include_once 'Services/Container/classes/class.ilContainerSortingSettings.php';
     if ($this->isActiveAdministrationPanel() && ilContainerSortingSettings::_lookupSortMode($this->object->getId()) == ilContainer::SORT_MANUAL) {
         $a_tpl->setCurrentBlock('block_position');
         $a_tpl->setVariable('POS_TYPE', $a_image_type);
         $a_tpl->setVariable('POS_ID', $a_item_ref_id);
         $a_tpl->setVariable('POSITION', sprintf('%.1f', $this->current_position++));
         $a_tpl->parseCurrentBlock();
     }
     if ($nbsp) {
         $a_tpl->setVariable("ROW_NBSP", " ");
     }
     $a_tpl->setCurrentBlock("container_standard_row");
     $a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
     $a_tpl->parseCurrentBlock();
     $a_tpl->touchBlock("container_row");
 }
 /**
  * Get path for tiny icon
  *
  * @return	string	icon path
  */
 function getTinyIconPath()
 {
     return ilContainer::_lookupIconPath($this->getId(), "tiny");
 }
 /**
  * get image path
  */
 function getImage($a_name, $a_type = "", $a_obj_id = "")
 {
     if ($a_type != "") {
         // custom icons
         if ($this->ilias->getSetting("custom_icons") && in_array($a_type, array("cat", "grp", "crs"))) {
             require_once "./Services/Container/classes/class.ilContainer.php";
             if (($path = ilContainer::_lookupIconPath($a_obj_id, "tiny")) != "") {
                 return $path;
             }
         }
     }
     return parent::getImage($a_name);
 }