How to get data in mij spreadsheet?

Hello all,

Im new with dhtmlxspreadsheet.
Installing and activating was no problem.
With some help i did get the code to show it in a article but now i can’t find where to eddit/fill the form.
Who can help me a bit?

aquamigo.nl/zoet/index.php/2 … 2-10-05-41

Hi,
it looks like there are some problems with correct detecting groups of current user.
Please, open file plugins/content/spreadsheet/spreadsheet_data.php and modify it like here:

echo "<pre>";
print_r($usertype);
print_r($available_to);
echo "</pre>";
$conn = new GridCellConnector($res, $table_prefix."dhx_");

After that open spreadsheet page. It will output some details before sheet. Could you provide it?

This is what’s in it now.
Where do i have to edit it?

<?php /*------------------------------------------------------------------------ # com_spreadsheet # ------------------------------------------------------------------------ # author DHTMLX # copyright (c) DHTMLX Ltd, 2011 # @license - [gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) GNU/GPL # Websites: [dhtmlx.com](http://www.dhtmlx.com) # Technical Support: [forum.dhtmlx.com/](http://forum.dhtmlx.com/) -------------------------------------------------------------------------*/ define('_JEXEC', 1); // no direct access defined('_JEXEC') or die('Restricted access'); define('DS', DIRECTORY_SEPARATOR); $path = dirname(__FILE__); $max = 0; while (!file_exists($path.DS.'configuration.php') && $max < 10) { $path .= DS.".."; $max++; } define('JPATH_BASE', $path); require_once(JPATH_BASE.DS.'configuration.php'); require_once(JPATH_BASE.DS.'includes'.DS.'defines.php'); require_once(JPATH_BASE.DS.'includes'.DS.'framework.php'); require_once(JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'user'.DS.'helper.php'); $mainframe =& JFactory::getApplication ('site'); $mainframe->initialise (); $mainframe->route(); require_once("./codebase/php/grid_cell_connector.php"); $cfg = new JConfig; $db_host = $cfg->host; $db_user = $cfg->user; $db_pass = $cfg->password; $db_name = $cfg->db; $db_prefix = $cfg->dbprefix."dhx_"; $available_to = Array( 'Super Users' => true, 'superadministrator' => true, 'administrator' => true, 'manager' => true ); $res = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name, $res); $user =& JFactory::getUser(); if (method_exists("JUserHelper", "getUserGroups")) { // get user type in Joomla 1.6 $user =& JFactory::getUser(); $gr = Array(); // multiple user groups $groups = $user->groups; $names = dhx_getGroups(); foreach ($groups as $k => $v) { $id = (string) $v; $gr[] = $names[$id]; } $usergroups = $gr; } else { // get user type in Joomla less then 1.6 switch($user->usertype) { case '': $usergroups = array('guest'); break; case 'Super Administrator': $usergroups = array('superadministrator'); break; default: $usergroups = array(strtolower($user->usertype)); } } $conn = new GridCellConnector($res, $db_prefix); if (!dhx_can($available_to, $usergroups)) $conn->set_read_only(true); $conn->render(); // gets all user groups list function dhx_getGroups() { $db = JFactory::getDBO(); $db->setQuery( 'SELECT a.id AS id, a.title AS title'. ' FROM #__usergroups AS a' . ' LEFT JOIN #__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' GROUP BY a.id ORDER BY a.lft ASC' ); $options = $db->loadObjectList(); $groups = array(); if ($options) { foreach ($options as &$option) $groups[$option->id] = $option->title; } else { $groups = array( 'registered' => 'Registered', 'author' => 'Author', 'editor' => 'Editor', 'publisher' => 'Publisher', 'manager' => 'Manager', 'administrator' => 'Administrator', 'superadministrator' => 'Super administrator' ); } return $groups; } function dhx_can($available_to, $usergroups) { for ($i = 0; $i < count($usergroups); $i++) if (isset($available_to[$usergroups[$i]])) return true; return false; } ?>

Hi,
you should add

echo "<pre>";
print_r($usertype);
print_r($available_to);
echo "</pre>";

before

$conn = new GridCellConnector($res, $db_prefix);
<?php /*------------------------------------------------------------------------ # com_spreadsheet # ------------------------------------------------------------------------ # author DHTMLX # copyright (c) DHTMLX Ltd, 2011 # @license - [gnu.org/licenses/gpl-2.0.html](http://www.gnu.org/licenses/gpl-2.0.html) GNU/GPL # Websites: [dhtmlx.com](http://www.dhtmlx.com) # Technical Support: [forum.dhtmlx.com/](http://forum.dhtmlx.com/) -------------------------------------------------------------------------*/ define('_JEXEC', 1); // no direct access defined('_JEXEC') or die('Restricted access'); define('DS', DIRECTORY_SEPARATOR); $path = dirname(__FILE__); $max = 0; while (!file_exists($path.DS.'configuration.php') && $max < 10) { $path .= DS.".."; $max++; } define('JPATH_BASE', $path); require_once(JPATH_BASE.DS.'configuration.php'); require_once(JPATH_BASE.DS.'includes'.DS.'defines.php'); require_once(JPATH_BASE.DS.'includes'.DS.'framework.php'); require_once(JPATH_BASE.DS.'libraries'.DS.'joomla'.DS.'user'.DS.'helper.php'); $mainframe =& JFactory::getApplication ('site'); $mainframe->initialise (); $mainframe->route(); require_once("./codebase/php/grid_cell_connector.php"); $cfg = new JConfig; $db_host = $cfg->host; $db_user = $cfg->user; $db_pass = $cfg->password; $db_name = $cfg->db; $db_prefix = $cfg->dbprefix."dhx_"; $available_to = Array( 'Super Users' => true, 'superadministrator' => true, 'administrator' => true, 'manager' => true ); $res = mysql_connect($db_host, $db_user, $db_pass); mysql_select_db($db_name, $res); $user =& JFactory::getUser(); if (method_exists("JUserHelper", "getUserGroups")) { // get user type in Joomla 1.6 $user =& JFactory::getUser(); $gr = Array(); // multiple user groups $groups = $user->groups; $names = dhx_getGroups(); foreach ($groups as $k => $v) { $id = (string) $v; $gr[] = $names[$id]; } $usergroups = $gr; } else { // get user type in Joomla less then 1.6 switch($user->usertype) { case '': $usergroups = array('guest'); break; case 'Super Administrator': $usergroups = array('superadministrator'); break; default: $usergroups = array(strtolower($user->usertype)); } } $conn = new GridCellConnector($res, $db_prefix); if (!dhx_can($available_to, $usergroups)) $conn->set_read_only(true); $conn->render(); // gets all user groups list function dhx_getGroups() { $db = JFactory::getDBO(); $db->setQuery( 'SELECT a.id AS id, a.title AS title'. ' FROM #__usergroups AS a' . ' LEFT JOIN #__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt' . ' GROUP BY a.id ORDER BY a.lft ASC' ); $options = $db->loadObjectList(); $groups = array(); if ($options) { foreach ($options as &$option) $groups[$option->id] = $option->title; } else { $groups = array( 'registered' => 'Registered', 'author' => 'Author', 'editor' => 'Editor', 'publisher' => 'Publisher', 'manager' => 'Manager', 'administrator' => 'Administrator', 'superadministrator' => 'Super administrator' ); } return $groups; } function dhx_can($available_to, $usergroups) { for ($i = 0; $i < count($usergroups); $i++) if (isset($available_to[$usergroups[$i]])) return true; return false; } ?>

echo “

”;
print_r($usertype);
print_r($available_to);
echo “
”;
$conn = new GridCellConnector($res, $table_prefix.“dhx_”);

That’s how it is now.

I don’t see any difrinds on the website :frowning:

Where to add the sheet???

Backend?
If so, where?

Sorry, my fault.
Your code must be like here:

echo "<pre>";
print_r($usergroups);
print_r($available_to);
echo "</pre>";
$conn = new GridCellConnector($res, $db_prefix);

After that open in browser the follow link:
aquamigo.nl//zoet/plugins/co … hp?sheet=3

It must include two arrays with user groups. Please, provide them.

When i open the link it wants do download it.
If i do open it (so not download it) it opens with dreamweaver

Tried it on diffrent computer, same problem!

Please, add required code and give me to know. I’ll look it myself.

I already did add it to the code!