foreach ($data['navigation_items'] as $i => $item) {
    if (isset($item[MIDCOM_NAV_SORTABLE]) && !$item[MIDCOM_NAV_SORTABLE]) {
        continue;
    }
    if ($item[MIDCOM_NAV_GUID]) {
        $identificator = $item[MIDCOM_NAV_GUID];
    } else {
        $identificator = $item[MIDCOM_NAV_ID];
    }
    $index = $count - $i;
    $style = '';
    if (isset($_GET['ajax'])) {
        $style = ' style="display: none;"';
    }
    // Get the icon from corresponding reflector class
    $icon = midcom_helper_reflector::get_object_icon($item[MIDCOM_NAV_OBJECT], true);
    // Actually we should skip all components that return the default icon as icon here!
    if (isset($item[MIDCOM_NAV_COMPONENT]) && $item[MIDCOM_NAV_COMPONENT] !== 'net.nehmer.static' && $item[MIDCOM_NAV_COMPONENT] !== 'net.nehmer.blog' && ($tmp = midcom::get('componentloader')->get_component_icon($item[MIDCOM_NAV_COMPONENT], false))) {
        $icon = MIDCOM_STATIC_URL . "/{$tmp}";
    }
    if ($icon) {
        $icon = " style=\"background-image: url('{$icon}');\"";
    } else {
        $icon = '';
    }
    if (!$item[MIDCOM_NAV_GUID]) {
        $icon = " style=\"background-image: url('" . MIDCOM_STATIC_URL . "/stock-icons/16x16/script.png');\"";
    }
    echo "        <li class=\"sortable {$item[MIDCOM_NAV_TYPE]}\"{$icon}>\n";
    echo "            <input type=\"text\" name=\"sortable[{$item[MIDCOM_NAV_TYPE]}][{$identificator}]\" value=\"{$index}\"{$style} />\n";
    echo "            {$item[MIDCOM_NAV_NAME]}\n";
Example #2
0
 /**
  * @dataProvider providerGet_object_icon
  */
 public function testGet_object_icon($classname, $icon)
 {
     $reflector = new midcom_helper_reflector($classname);
     $object = new $classname();
     $this->assertEquals(MIDCOM_STATIC_URL . $icon, $reflector->get_object_icon($object, true));
 }
Example #3
0
 private function _draw_type_list(array $types)
 {
     echo "<ul class=\"midgard_admin_asgard_navigation\">\n";
     foreach ($types as $type => $label) {
         $url = midcom_connection::get_url('self') . "__mfa/asgard/{$type}";
         echo "    <li class=\"mgdschema-type\">";
         $dbaclass = midcom::get('dbclassloader')->get_midcom_class_name_for_mgdschema_object($type);
         if ($dbaclass) {
             $object = new $dbaclass();
         } else {
             $object = new $type();
         }
         $icon = midcom_helper_reflector::get_object_icon($object);
         echo "<a href=\"" . $url . "\" title=\"{$label}\">{$icon}{$label}</a>\n";
         echo "    </li>\n";
     }
     echo "</ul>\n";
 }