예제 #1
0
 function getLinks($args)
 {
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             $categories = WFLinkBrowser::getCategory('com_contact');
             foreach ($categories as $category) {
                 $itemid = WFLinkBrowser::getItemId('com_contact', array('categories' => null, 'category' => $category->slug));
                 $items[] = array('id' => 'index.php?option=com_contact&view=category&catid=' . $category->slug . $itemid, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder contact');
             }
             break;
         case 'category':
             $categories = WFLinkBrowser::getCategory('com_contact', $args->catid);
             foreach ($categories as $category) {
                 $children = WFLinkBrowser::getCategory('com_contact', $category->id);
                 if ($children) {
                     $id = 'index.php?option=com_contact&view=category&catid=' . $category->id;
                 } else {
                     $itemid = WFLinkBrowser::getItemId('com_contact', array('categories' => null, 'category' => $category->slug));
                     $id = 'index.php?option=com_contact&view=category&catid=' . $category->slug . $itemid;
                 }
                 $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
             }
             $contacts = self::_contacts($args->catid);
             foreach ($contacts as $contact) {
                 $catid = $args->catid ? '&catid=' . $args->catid : '';
                 $itemid = WFLinkBrowser::getItemId('com_contact', array('categories' => null, 'category' => $catid));
                 $items[] = array('id' => 'index.php?option=com_contact&view=contact' . $catid . '&id=' . $contact->id . $itemid . '-' . $contact->alias, 'name' => $contact->name . ' / ' . $contact->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
예제 #2
0
 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                 $items[] = array('id' => 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
             }
             break;
             // Get all links in the category
         // Get all links in the category
         case 'category':
             require_once JPATH_SITE . DS . 'includes' . DS . 'application.php';
             require_once JPATH_SITE . DS . 'components' . DS . 'com_weblinks' . DS . 'helpers' . DS . 'route.php';
             if (!WF_JOOMLA15) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->slug));
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->slug . $itemid;
                         }
                         $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $items[] = array('id' => WeblinksHelperRoute::getWeblinkRoute($weblink->id, $args->id), 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
예제 #3
0
 function getLinks($args)
 {
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact');
             } else {
                 $categories = WFLinkBrowser::getCategory('com_contact_details');
             }
             foreach ($categories as $category) {
                 $itemid = WFLinkBrowser::getItemId('com_contact', array('category' => $category->id));
                 if (defined('JPATH_PLATFORM')) {
                     $url = 'index.php?option=com_contact&view=category&id=';
                 } else {
                     $url = 'index.php?option=com_contact&view=category&catid=';
                 }
                 $items[] = array('id' => 'index.php?option=com_contact&view=category&id=' . $category->id, 'url' => $url . $category->slug . $itemid, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder contact');
             }
             break;
         case 'category':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact', $args->id);
                 foreach ($categories as $category) {
                     $children = WFLinkBrowser::getCategory('com_contact', $category->id);
                     if ($children) {
                         $id = 'index.php?option=com_contact&view=category&id=' . $category->id;
                     } else {
                         $itemid = WFLinkBrowser::getItemId('com_contact', array('category' => $category->id));
                         if (!$itemid && isset($args->Itemid)) {
                             // fall back to the parent item's Itemid
                             $itemid = '&Itemid=' . $args->Itemid;
                         }
                         $id = 'index.php?option=com_contact&view=category&id=' . $category->slug . $itemid;
                     }
                     $items[] = array('id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
                 }
             }
             $contacts = self::_contacts($args->id);
             foreach ($contacts as $contact) {
                 $catid = $args->id ? '&catid=' . $args->id : '';
                 $itemid = WFLinkBrowser::getItemId('com_contact', array('contact' => $contact->id));
                 if (!$itemid && isset($args->Itemid)) {
                     // fall back to the parent item's Itemid
                     $itemid = '&Itemid=' . $args->Itemid;
                 }
                 $items[] = array('id' => 'index.php?option=com_contact&view=contact' . $catid . '&id=' . $contact->id . '-' . $contact->alias . $itemid, 'name' => $contact->name . ' / ' . $contact->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
예제 #4
0
    private function _getSection() {
        $db = JFactory::getDBO();
        $user = JFactory::getUser();

        if (method_exists('JUser', 'getAuthorisedViewLevels')) {
            return WFLinkBrowser::getCategory('com_content');
        } else {
            $query = 'SELECT id, title, alias, access'
                    . ' FROM #__sections'
                    . ' WHERE published = 1'
                    . ' AND access <= ' . (int) $user->get('aid')
                    //. ' GROUP BY id'
                    . ' ORDER BY title'
            ;

            $db->setQuery($query);
            return $db->loadObjectList();
        }
    }
예제 #5
0
파일: contact.php 프로젝트: ziyou-liu/1line
 public function getLinks($args)
 {
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     $language = '';
     if (defined('JPATH_PLATFORM')) {
         require_once JPATH_SITE . '/components/com_contact/helpers/route.php';
     }
     switch ($view) {
         default:
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact');
             } else {
                 $categories = WFLinkBrowser::getCategory('com_contact_details');
             }
             foreach ($categories as $category) {
                 if (defined('JPATH_PLATFORM')) {
                     // language
                     if (isset($category->language)) {
                         $language = $category->language;
                     }
                     $url = ContactHelperRoute::getCategoryRoute($category->id, $language);
                 } else {
                     $itemid = WFLinkBrowser::getItemId('com_contact', array('category' => $category->id));
                     $url = 'index.php?option=com_contact&view=category&catid=' . $category->slug . $itemid;
                 }
                 // convert to SEF
                 $url = self::route($url);
                 $items[] = array('id' => 'index.php?option=com_contact&view=category&id=' . $category->id, 'url' => $url, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder contact');
             }
             break;
         case 'category':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_contact', $args->id);
                 foreach ($categories as $category) {
                     $children = WFLinkBrowser::getCategory('com_contact', $category->id);
                     // language
                     if (isset($category->language)) {
                         $language = $category->language;
                     }
                     if ($children) {
                         $id = ContactHelperRoute::getCategoryRoute($category->id, $language);
                     } else {
                         $id = ContactHelperRoute::getCategoryRoute($category->slug, $language);
                     }
                     // convert to SEF
                     $url = self::route($id);
                     $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder content');
                 }
             }
             $contacts = self::_contacts($args->id);
             foreach ($contacts as $contact) {
                 // language
                 if (isset($contact->language)) {
                     $language = $contact->language;
                 }
                 if (defined('JPATH_PLATFORM')) {
                     $id = ContactHelperRoute::getContactRoute($contact->id, $args->id, $language);
                 } else {
                     $catid = $args->id ? '&catid=' . $args->id : '';
                     $itemid = WFLinkBrowser::getItemId('com_contact', array('contact' => $contact->id));
                     if (!$itemid && isset($args->Itemid)) {
                         // fall back to the parent item's Itemid
                         $itemid = '&Itemid=' . $args->Itemid;
                     }
                     $id = 'index.php?option=com_contact&view=contact' . $catid . '&id=' . $contact->id . '-' . $contact->alias . $itemid;
                 }
                 $id = self::route($id);
                 $items[] = array('id' => $id, 'name' => $contact->name . ' / ' . $contact->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
예제 #6
0
 public function getLinks($args)
 {
     $wf = WFEditorPlugin::getInstance();
     $items = array();
     require_once JPATH_SITE . '/includes/application.php';
     require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
     switch ($args->view) {
         // Get all WebLink categories
         default:
         case 'categories':
             $categories = WFLinkBrowser::getCategory('com_weblinks');
             foreach ($categories as $category) {
                 $url = '';
                 $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                 if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                     $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                     if (strpos($id, 'index.php?Itemid=') !== false) {
                         $url = $id;
                         $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                     }
                 } else {
                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                 }
                 $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
             }
             break;
             // Get all links in the category
         // Get all links in the category
         case 'category':
             if (defined('JPATH_PLATFORM')) {
                 $categories = WFLinkBrowser::getCategory('com_weblinks', $args->id);
                 if (count($categories)) {
                     foreach ($categories as $category) {
                         $children = WFLinkBrowser::getCategory('com_weblinks', $category->id);
                         $url = '';
                         if ($children) {
                             $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                         } else {
                             $itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
                             if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
                                 $id = WeblinksHelperRoute::getCategoryRoute($category->id);
                                 if (strpos($id, 'index.php?Itemid=') !== false) {
                                     $url = $id;
                                     $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
                                 }
                             } else {
                                 $id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
                             }
                         }
                         $items[] = array('url' => $url, 'id' => $id, 'name' => $category->title . ' / ' . $category->alias, 'class' => 'folder weblink');
                     }
                 }
             }
             $weblinks = self::_weblinks($args->id);
             foreach ($weblinks as $weblink) {
                 $id = WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug);
                 if (defined('JPATH_PLATFORM')) {
                     $id .= '&task=weblink.go';
                 }
                 $items[] = array('id' => $id, 'name' => $weblink->title . ' / ' . $weblink->alias, 'class' => 'file');
             }
             break;
     }
     return $items;
 }
예제 #7
0
 private function _getSection()
 {
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     if (isset($user->gid)) {
         $query = 'SELECT id, title, alias' . ' FROM #__sections' . ' WHERE published = 1' . ' AND access <= ' . (int) $user->get('aid') . ' ORDER BY title';
         $db->setQuery($query);
         return $db->loadObjectList();
     } else {
         return WFLinkBrowser::getCategory('com_content');
     }
 }
예제 #8
0
 function getLinks($args)
 {
     global $_DOCMAN, $mainframe;
     $wf = WFEditorPlugin::getInstance();
     jimport('joomla.filesystem.file');
     require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'docman.class.php';
     //DOCMan core interaction API
     $_DOCMAN = new dmMainFrame(_DM_TYPE_DOCLINK);
     // Load classes and language
     require_once $_DOCMAN->getPath('classes', 'utils');
     $cid = isset($args->gid) ? $args->gid : 0;
     //get folders
     $categories = DOCMAN_Cats::getChildsByUserAccess($cid);
     $items = array();
     $view = isset($args->view) ? $args->view : '';
     switch ($view) {
         default:
             foreach ($categories as $category) {
                 $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks');
             }
             break;
         case 'category':
             //get items
             if ($cid) {
                 $categories = DOCMAN_Cats::getChildsByUserAccess($cid);
                 $documents = DOCMAN_Docs::getDocsByUserAccess($cid, 'name', 'ASC', 999, 0);
             } else {
                 $categories = array();
                 $documents = array();
             }
             foreach ($categories as $category) {
                 $items[] = array('id' => 'index.php?option=com_docman&view=category&gid=' . $category->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $category->name, 'class' => 'folder docmanlinks');
             }
             foreach ($documents as $document) {
                 $items[] = array('id' => 'index.php?option=com_docman&task=doc_' . $wf->getParam('docmanlinks_link', 'download') . '&gid=' . $document->id . WFLinkBrowser::getItemId('com_docman'), 'name' => $document->dmname, 'class' => 'file docmanlinks ' . JFile::getExt($document->dmfilename));
             }
             break;
     }
     return $items;
 }