PDA

Zobacz pełną wersję : [phocadownload] Problem z dodaniem pliku do artykułu



cycleteam
26-09-2011, 19:15
Witam

Mam stronę opartą o Joomla 1.7

Zaznaczam że przeszukałem google i nie mogę znaleźć odpowiedzi na moje pytania a mianowicie mam problem z dodaniem linku do artykułu który spowoduje pobranie pliku.

Chcę dodać plik regulamin.doc - plik wgrałem na serwer do katalogu phocadownload za pomocą zainstalowanego komponentu.

Według instrukcji na stronie autora pod oknem służącym do pisania artykułu powinien pojawić się przycisk do obsługi komponentu (do dodania pliku) jednak u mnie tego nie ma. Może jakoś inaczej jest w joomla 1.7 bo zauważyłem że instrukcja jest to joomla 1.5.

Próbowałem dodać plik do artykułu poprzez {phocadownload view=file|id=1} ale także nie ma rezultatu.

Proszę o pomoc. Wiele godzin poświęciłem żeby dodać plik i brak rezultatu.

trzepiz
26-09-2011, 19:45
Proszę o pomoc. Wiele godzin poświęciłem żeby dodać plik i brak rezultatu.

To zacznij wszystko czytać ze zrozumieniem i

1. pobierz plugin, który odpowiada za dodanie przycisku w edytorze --> http://www.phoca.cz/download/category/44-phoca-download-button-plugin
2. zainstaluj go
3. wejdź do zakładki Rozszerzenia > Dodatki odszukaj ten dodatek i go włącz !

cycleteam
27-09-2011, 15:14
No tak.. Dodatek jeszcze.

Przycisk się pojawił tylko problem z dodaniem pliku. Gdy wybieram "link to file"

to wyskakuje komunikat..


Fatal error: Call to a member function getUserStateFromRequest() on a non-object in /home/straz/public_html/administrator/components/com_phocadownload/models/phocadownloadlinkfile.php on line 25


Kod pliku phocadownloadlinkfile.php


<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Component
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
jimport('joomla.application.component.model');

class PhocaDownloadCpModelPhocaDownloadLinkFile extends JModel
{
var $_data = null;
var $_total = null;
var $_pagination = null;
var $_context = 'com_phocadownload.phocadownloadlinkfile';

function __construct() {
parent::__construct();
global $mainframe;
// Get the pagination request variables
$limit = $mainframe->getUserStateFromRequest( $this->_context.'.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
$limitstart = $mainframe->getUserStateFromRequest( $this->_context.'.limitstart', 'limitstart', 0, 'int' );
// In case limit has been changed, adjust limitstart accordingly
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);

$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
}

function getData() {
if (empty($this->_data)) {
$query = $this->_buildQuery();
$this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
}
return $this->_data;
}

function getTotal() {
if (empty($this->_total)) {
$query = $this->_buildQuery();
$this->_total = $this->_getListCount($query);
}
return $this->_total;
}

function getPagination() {
if (empty($this->_pagination)) {
jimport('joomla.html.pagination');
$this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
}
return $this->_pagination;
}

function _buildQuery() {
$where = $this->_buildContentWhere();
$orderby = $this->_buildContentOrderBy();

$query = ' SELECT a.*, cc.title AS categorytitle, s.title AS sectiontitle, u.name AS editor, g.name AS groupname '
. ' FROM #__phocadownload AS a '
. ' LEFT JOIN #__phocadownload_categories AS cc ON cc.id = a.catid '
. ' LEFT JOIN #__phocadownload_sections AS s ON s.id = a.sectionid '
. ' LEFT JOIN #__groups AS g ON g.id = a.access '
. ' LEFT JOIN #__users AS u ON u.id = a.checked_out '
. $where
. $orderby
;

return $query;
}

function _buildContentOrderBy() {
global $mainframe;
$filter_order = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering','cmd' );
$filter_order_Dir = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );

if ($filter_order == 'a.ordering'){
$orderby = ' ORDER BY sectiontitle, categorytitle, a.ordering '.$filter_order_Dir;
} else {
$orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , sectiontitle, categorytitle, a.ordering ';
}
return $orderby;
}

function _buildContentWhere() {
global $mainframe;
$filter_state = $mainframe->getUserStateFromRequest( $this->_context.'.filter_state', 'filter_state', '', 'word' );
$filter_catid = $mainframe->getUserStateFromRequest( $this->_context.'.catid','catid',0, 'int' );
$filter_sectionid = $mainframe->getUserStateFromRequest( $this->_context.'.filter_sectionid', 'filter_sectionid', 0, 'int' );
$filter_order = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order', 'filter_order', 'a.ordering', 'cmd' );
$filter_order_Dir = $mainframe->getUserStateFromRequest( $this->_context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' );
$search = $mainframe->getUserStateFromRequest( $this->_context.'.search','search','','string' );
$search = JString::strtolower( $search );

$where = array();

if ($filter_catid > 0) {
$where[] = 'a.catid = '.(int) $filter_catid;
}
if ($search) {
$where[] = 'LOWER(a.title) LIKE '.$this->_db->Quote('%'.$search.'%');
}
if ( $filter_state ) {
if ( $filter_state == 'P' ) {
$where[] = 'a.published = 1';
} else if ($filter_state == 'U' ) {
$where[] = 'a.published = 0';
}
}
if ( $filter_sectionid ) {
$where[] = 'cc.section = '.(int)$filter_sectionid;
}

$where[] = 'a.published = 1';
$where[] = 'a.approved = 1';
$where[] = 'a.textonly <> 1';

$where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' );
return $where;
}
}
?>