Works on product canvas and templates
Add possibility to move canvas directory to module directory
This commit is contained in:
parent
9dc1c8344e
commit
3c8507cc60
@ -42,9 +42,10 @@ class Canvas
|
|||||||
* \brief Constructor.
|
* \brief Constructor.
|
||||||
* \param DB Database handler
|
* \param DB Database handler
|
||||||
*/
|
*/
|
||||||
function Canvas($DB=0)
|
function Canvas($DB=0,$user)
|
||||||
{
|
{
|
||||||
$this->db = $DB ;
|
$this->db = $DB ;
|
||||||
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,8 +57,6 @@ class Canvas
|
|||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
||||||
{
|
{
|
||||||
var_dump($regs);
|
|
||||||
$ret = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php'; print $ret;
|
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php'))
|
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php'))
|
||||||
{
|
{
|
||||||
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php';
|
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php';
|
||||||
@ -65,7 +64,7 @@ class Canvas
|
|||||||
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/tpl/';
|
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/tpl/';
|
||||||
|
|
||||||
include_once($filecanvas);
|
include_once($filecanvas);
|
||||||
$this->object = new $classname($db,0,$user);
|
$this->object = new $classname($this->db,0,$this->user);
|
||||||
$this->smarty = $this->object->smarty;
|
$this->smarty = $this->object->smarty;
|
||||||
|
|
||||||
return $this->object;
|
return $this->object;
|
||||||
@ -95,7 +94,7 @@ class Canvas
|
|||||||
{
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
|
||||||
$smarty->assign_smarty_values($this->smarty, $this->action);
|
$this->object->assign_smarty_values($smarty, $this->action);
|
||||||
$smarty->template_dir = $this->template_dir;
|
$smarty->template_dir = $this->template_dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -116,7 +115,7 @@ class Canvas
|
|||||||
{
|
{
|
||||||
global $smarty;
|
global $smarty;
|
||||||
|
|
||||||
$this->smarty->display($this->action.'.tpl');
|
$smarty->display($this->action.'.tpl');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -634,10 +634,10 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
|
|
||||||
if (! isset($product))
|
if (! isset($product))
|
||||||
{
|
{
|
||||||
$canvas = new Canvas();
|
$canvas = new Canvas($db,$user);
|
||||||
|
|
||||||
$product = $canvas->load_canvas('product',$_GET["canvas"]);
|
$product = $canvas->load_canvas('product',$_GET["canvas"]);
|
||||||
print $canvas->error;
|
|
||||||
$canvas->assign_values($_GET["action"],$smarty);
|
$canvas->assign_values($_GET["action"],$smarty);
|
||||||
$canvas->display_canvas();
|
$canvas->display_canvas();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user