Jump to content
  • 0

Custome Module In Blesta


jkmorayur

Question

I have created a new module bellow my module structure

 

modules ->

              test ->

                        apis ->

                                   test_api.php

                        language ->

                                          en_us->

                                                      test.php

                        views ->

                                     default ->

                                                    images ->

                                                                    add_row.pdt

                                                                    admin_service_info.pdt

                                                                    client_service_info.pdt

                                                                    manage.pdt

                                                                    edit_row.pdt

                                                                    change_password.pdt

                        text.php

 

and i set link button on manage.pdt as follows

 

$link_buttons = array(
      array('name' => $this->_("Test.add_module_change_password", true), 'attributes' => array('href' => $this->base_uri .    "settings/company/modules/changepassword/" . $module->id))
);

 

i have a 404 error occure when i click change password link (button link specified on manage.pdt) and i attached the error image

post-4364-0-68418600-1383307481_thumb.pn

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Why do you need to change a password from the manage module section? Isn't that what the Module::manageAddRow() and Module::manageEditRow() methods are for?

 

Nonetheless, if you wanted to have custom tabs, you would need to use GET parameters, and handle them in your Module::manageModule() method.

 

 

So:

$link_buttons = array(

      array('name' => $this->_("Test.add_module_change_password", true), 'attributes' => array('href' => $this->base_uri .    "settings/company/modules/changepassword/" . $module->id))
);

 

may link to:

$link_buttons = array(
      array('name' => $this->_("Test.add_module_change_password", true), 'attributes' => array('href' => $this->base_uri .    "settings/company/modules/manage/" . $module->id . "/changepassword/"))
);

 

and then you would update your module:


	public function manageModule($module, array &$vars) {
		// Load the view into this object, so helpers can be automatically added to the view
                if (isset($_GET[1]) && $_GET[1] == "changepassword") {
                    $this->view = new View("change_password", "default");
                    #
                    # TODO: to whatever else you need to do
                    #
                }
                else {
		    $this->view = new View("manage", "default");
                }
		$this->view->base_uri = $this->base_uri;
		$this->view->setDefaultView("components" . DS . "modules" . DS . "test" . DS);
		
		// Load the helpers required for this view
		Loader::loadHelpers($this, array("Form", "Html", "Widget"));

		$this->view->set("module", $module);
		
		return $this->view->fetch();
	}

 

I haven't tested this, but that should be pretty close to getting it to work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...