Example #1
0
    protected function _fetchData(KViewContext $context)
    {
        // Load administrator language file for messages
        $this->getObject('translator')->load('com://admin/docman');

        //Pages
        $pages = $this->getObject('com://admin/docman.model.pages')
            ->view(array('list', 'document', 'filteredlist', 'submit'))
            ->language('all')
            ->fetch();

        foreach ($pages as $page)
        {
            if ($page->query['view'] === 'list') {
                $page->categories = $this->getObject('com://admin/docman.model.categories')->page($page->id)->fetch();
            } else {
                $page->categories = array();
            }
        }

        $context->data->pages = $pages;
        $context->data->admin = JFactory::getApplication()->isAdmin();

        parent::_fetchData($context);
    }
Example #2
0
 protected function _fetchData(KViewContext $context)
 {
     //Categories list
     $context->data->categories = $this->getObject('com://admin/docman.controller.category')->limit(0)->sort('title')->browse();
     $context->data->categories->setDocumentCount();
     parent::_fetchData($context);
 }
Example #3
0
    protected function _fetchData(KViewContext $context)
    {
        $document = $this->getModel()->fetch();

        if ($this->getLayout() !== 'form')
        {
            $params                       = $this->getParameters();
            $context->data->event_context = 'com_docman.document';

            $this->prepareDocument($document, $params, $context->data->event_context);

            //Settings
            $query = $this->getActiveMenu()->query;
            if ($query['view'] === 'document' && $query['slug'] === $document->slug) {
                $context->data->show_delete = false;
            }
        }
        else
        {
            $view = $this->getActiveMenu()->query['view'];

            if ($view === 'userlist' && $document->isPermissible() && !$document->canPerform('manage')) {
                $context->data->hide_owner_field = true;
            }
        }

        parent::_fetchData($context);
    }
Example #4
0
    protected function _fetchData(KViewContext $context)
    {
        if ($this->getLayout() != 'success')
        {
            $page = JFactory::getApplication()->getMenu()->getActive();

            $context->data->document        = $this->getModel()->fetch();
            $context->data->show_categories = $page->params->get('category_children');

            if ($context->data->show_categories)
            {
                $context->data->category = $this->getObject('com://site/docman.model.categories')
                    ->id($page->params->get('category_id'))
                    ->fetch();

                $categories = $this->getObject('com://site/docman.model.categories')->setState(array(
                    'parent_id' => $context->data->category->id,
                    'access'    => $this->getObject('user')->getRoles(),
                    'enabled'   => true
                ))->fetch();

                if (!count($categories)) {
                    $context->data->show_categories = false;
                }
            }

        }
        else $context->data->page = JFactory::getApplication()->getMenu()->getDefault();

        parent::_fetchData($context);
    }
Example #5
0
 protected function _fetchData(KViewContext $context)
 {
     parent::_fetchData($context);
     $context->data->categories->setDocumentCount();
     // For the sidebar tree
     $context->data->all_categories = $this->getObject('com://admin/docman.controller.category')->limit(0)->sort($this->getModel()->getState()->sort)->browse();
 }
Example #6
0
 protected function _fetchData(KViewContext $context)
 {
     // Load administrator language file for messages
     $this->getObject('translator')->load('com://admin/docman');
     //Pages
     $pages = $this->getObject('com://admin/docman.model.pages')->view(array('list', 'document', 'filteredlist', 'submit'))->language('all')->sort('title')->fetch();
     $context->data->pages = $pages;
     $context->data->admin = JFactory::getApplication()->isAdmin();
     parent::_fetchData($context);
 }
Example #7
0
    protected function _fetchData(KViewContext $context)
    {
        $context->data->upload_max_filesize = ComDocmanModelEntityExtension::getMaximumUploadSize();

        $context->data->filetypes = array(
            'archive' => array('7z', 'ace', 'bz2', 'dmg', 'gz', 'rar', 'tgz', 'zip'),
            'document' => array('csv', 'doc', 'docx', 'html', 'key', 'keynote', 'odp', 'ods', 'odt', 'pages', 'pdf', 'pps', 'ppt', 'pptx', 'rtf', 'tex', 'txt', 'xls', 'xlsx', 'xml'),
            'image' => array('bmp', 'exif', 'gif', 'ico', 'jpeg', 'jpg', 'png', 'psd', 'tif', 'tiff'),
            'audio' => array('aac', 'aif', 'aiff', 'alac', 'amr', 'au', 'cdda', 'flac', 'm3u', 'm3u', 'm4a', 'm4a', 'm4p', 'mid', 'mp3', 'mp4', 'mpa', 'ogg', 'pac', 'ra', 'wav', 'wma'),
            'video' => array('3gp', 'asf', 'avi', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'ogg', 'rm', 'swf', 'vob', 'wmv')
        );

        parent::_fetchData($context);
    }
Example #8
0
    protected function _fetchData(KViewContext $context)
    {
        $params = $this->getParameters();

        $context->data->event_context = 'com_docman.documents';
        $context->data->documents = $this->getModel()->fetch();
        $context->data->total     = $this->getModel()->count();

        foreach ($context->data->documents as $document) {
            $this->prepareDocument($document, $params, $context->data->event_context);
        }

        parent::_fetchData($context);

        $context->parameters->total = $this->getModel()->count();
    }
Example #9
0
 protected function _fetchData(KViewContext $context)
 {
     parent::_fetchData($context);
     $context->data->parent = $this->getModel()->fetch()->getParent();
     $category = $context->data->category;
     $ignored_parents = array();
     if ($category->id) {
         $ignored_parents[] = $category->id;
         foreach ($category->getDescendants() as $descendant) {
             $ignored_parents[] = $descendant->id;
         }
     }
     $context->data->ignored_parents = $ignored_parents;
     $table = $this->getObject('com://admin/docman.database.table.viewlevels');
     $entities = $table->select(array(), KDatabase::FETCH_ROWSET);
     $context->data->viewlevels = $entities->toArray();
     $access = (int) (JFactory::getConfig()->get('access') || 1);
     $context->data->default_access = $entities->find($access) ?: $entities->create();
 }
Example #10
0
    protected function _fetchData(KViewContext $context)
    {
        parent::_fetchData($context);

        $context->data->parent          = $this->getModel()->fetch()->getParent();
        $context->data->default_access = $this->getObject('com://admin/docman.model.viewlevels')
            ->id((int) (JFactory::getConfig()->get('access') || 1))
            ->fetch();

        $category = $context->data->category;
        $ignored_parents = array();

        if ($category->id) {
            $ignored_parents[] = $category->id;
            foreach ($category->getDescendants() as $descendant) {
                $ignored_parents[] = $descendant->id;
            }
        }

        $context->data->ignored_parents = $ignored_parents;
    }
Example #11
0
    protected function _fetchData(KViewContext $context)
    {
        $context->data->append(array(
            'event_context' => 'com_docman.list'
        ));

        $state  = $this->getModel()->getState();
        $params = $this->getParameters();
        $user   = $this->getObject('user');

        /*
         * Automatically render the first category for top level tree view
         *
         * Otherwise the content pane will be empty and the page will only display the sidebar
         * We are putting a canonical URL for the actual category link for SEO purposes
         */
        if (in_array($this->getLayout(), array('tree', 'treetable')) && !$this->getModel()->getState()->isUnique())
        {
            $first         = $this->getModel()->limit(1)->fetch();
            $state->slug   = $first->slug;
            $category_link = $this->getTemplate()->createHelper('com://admin/docman.template.helper.route')
                                ->category(array('entity' => $first), true);

            $this->getObject('response')->getHeaders()->set('Link', '<'.$category_link.'>; rel="canonical"');
        }

        //Category
        if ($this->getModel()->getState()->isUnique()) {
            $category = $this->getModel()->fetch();
        }
        else
        {
            $category = $this->getModel()->create();
            $category->title = $params->page_heading ? $params->page_heading : $this->getActiveMenu()->title;
        }

        if ($state->isUnique() && $category->isNew()) {
            throw new KControllerExceptionResourceNotFound('Category not found');
        }

        //Subcategories
        if ($params->show_subcategories)
        {
            $subcategories = $this->getObject('com://site/docman.model.categories')
                ->level(1)
                ->parent_id($category->id)
                ->enabled($state->enabled)
                ->access($state->access)
                ->current_user($user->getId())
                ->page($state->page)
                ->sort($params->sort_categories)
                ->limit(0)
                ->fetch();
        }
        else $subcategories = array();

        //Documents
        if ($category->id)
        {
            $model = $this->getObject('com://site/docman.controller.document')
                ->enabled($state->enabled)
                ->status($state->status)
                ->access($state->access)
                ->current_user($user->getId())
                ->page($state->page)
                ->category($category->id)
                ->limit($state->limit)
                ->offset($state->offset)
                ->sort($state->sort)
                ->direction($state->direction)
                ->getModel();

            $total     = $model->count();
            $documents = $model->fetch();

            foreach ($documents as $document) {
                $this->prepareDocument($document, $params, $context->data->event_context);
            }
        }
        else
        {
            $total     = 0;
            $documents = array();
        }

        $context->data->category      = $category;
        $context->data->documents     = $documents;
        $context->data->total         = $total;
        $context->data->subcategories = $subcategories;

        parent::_fetchData($context);

        $context->parameters->total   = $total;
    }
Example #12
0
    protected function _fetchData(KViewContext $context)
    {
        $context->data->append(array(
            'event_context' => 'com_docman.list'
        ));

        $state  = $this->getModel()->getState();
        $params = $this->getParameters();
        $user   = $this->getObject('user');

        //Category
        if ($this->getModel()->getState()->isUnique()) {
            $category = $this->getModel()->fetch();
        }
        else
        {
            $category = $this->getModel()->create();
            $category->title = $params->page_heading ? $params->page_heading : $this->getActiveMenu()->title;
        }

        if ($state->isUnique() && $category->isNew()) {
            throw new KControllerExceptionResourceNotFound('Category not found');
        }

        //Subcategories
        if ($params->show_subcategories)
        {
            $subcategories = $this->getObject('com://site/docman.model.categories')
                ->level(1)
                ->parent_id($category->id)
                ->enabled($state->enabled)
                ->access($state->access)
                ->current_user($user->getId())
                ->page($state->page)
                ->sort($params->sort_categories)
                ->limit(0)
                ->fetch();
        }
        else $subcategories = array();

        //Documents
        if ($category->id)
        {
            $model = $this->getObject('com://site/docman.controller.document')
                ->enabled($state->enabled)
                ->status($state->status)
                ->access($state->access)
                ->current_user($user->getId())
                ->page($state->page)
                ->category($category->id)
                ->limit($state->limit)
                ->offset($state->offset)
                ->sort($state->sort)
                ->direction($state->direction)
                ->getModel();

            $total     = $model->count();
            $documents = $model->fetch();

            foreach ($documents as $document) {
                $this->prepareDocument($document, $params, $context->data->event_context);
            }
        }
        else
        {
            $total     = 0;
            $documents = array();
        }

        $context->data->category      = $category;
        $context->data->documents     = $documents;
        $context->data->total         = $total;
        $context->data->subcategories = $subcategories;

        parent::_fetchData($context);

        $context->parameters->total   = $total;
    }