Jump to content
  • 0

How to Add "Quick Links" onto the Admin "Home" Dashboard


turner2f

Question

I see on the Home Page of the Admin's dashboard that there is a place for adding custom "Quick Links" to the left-side navigation.

------------------------

NOTE :

If you go to . . .  

blest/language/en_us/admin_main.php

You will see the following code . . .

23. // Index
24. $lang['AdminMain.index.page_title'] = 'Dashboard';
25. $lang['AdminMain.index.heading_quicklinks'] = 'Quick Links';
26. $lang['AdminMain.index.no_quicklinks'] = 'No Quick Links have been set.';
27. $lang['AdminMain.index.manage_widgets'] = 'Manage Widgets';
28. $lang['AdminMain.index.customize_dashboard'] = 'Customize Dashboard';

 

How do we add our own custom "Quick Links" to the left-side navigation bar ?
 

1) - Is it via a plugin ?

2) - Is it via the Admin interface ?

3) - Or do the links have to be hard-coded in  ? If yes, which .PDT file ?

 

...

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

QUICK NOTE:

I found the following code at . . .

blesta/app/views/admin/default/admin_main.pdt

 

<section class="quick_links">
                        <h3><?php $this->_('AdminMain.index.heading_quicklinks');?></h3>
                        <ul>
                        <?php
                        if (!empty($quicklinks)) {
                            foreach ($quicklinks as $quicklink) {
                        ?>
                            <li>
                                <div class="quick_link">
                                    <a href="<?php $this->Html->_($quicklink->uri);?>"><?php $this->Html->_($quicklink->title);?></a>
                                </div>
                                <i class="fa fa-pencil pull-right"></i>
                            </li>
                        <?php
                            }
                        } else {
                        ?>
                            <li><?php $this->_('AdminMain.index.no_quicklinks');?></li>
                        <?php
                        }
                        ?>
                        </ul>
 </section>

 

So how do we add our own custom "Quick Links" to the left-side navigation bar ?
 

1) - Is it via a plugin ?

2) - Is it via the Admin interface ?

3) - Or do the links have to be hard-coded in  ? If yes, which .PDT file ?

 

...

 

 

Link to comment
Share on other sites

  • 0

@Jono

Thanks for the reply.

Is there a way we can HARD CODE in our own "custom" links.

For instance, I have a Wordpress website that has an interface for the different employees to have THEIR OWN separate, private calendars.

A function that Blesta does not currently support.

____________________________________


So I would like to HARD CODE a URL link within the left-side navigation of the Blesta Admin home page that would take the employees to the WordPress website .


1) - Can you please provide an example of where we would HARD CODE a custom URL link to a separate website within the code at . . .

blesta/app/views/admin/default/admin_main.pdt

 

 

<section class="quick_links">
                        <h3><?php $this->_('AdminMain.index.heading_quicklinks');?></h3>
                        <ul>
                        <?php
                        if (!empty($quicklinks)) {
                            foreach ($quicklinks as $quicklink) {
                        ?>
                            <li>
                                <div class="quick_link">
                                    <a href="<?php $this->Html->_($quicklink->uri);?>"><?php $this->Html->_($quicklink->title);?></a>
                                </div>
                                <i class="fa fa-pencil pull-right"></i>
                            </li>
                        <?php
                            }
                        } else {
                        ?>
                            <li><?php $this->_('AdminMain.index.no_quicklinks');?></li>
                        <?php
                        }
                        ?>
                        </ul>
 </section>

 

...

Link to comment
Share on other sites

  • 0

You can do this either in the view app/views/admin/default/admin_main.pdt or in the controller app/controllers/admin_main.php.  In the view you would change:

                        if (!empty($quicklinks)) {

To something like this

                        $quicklinks = array_merge([(object)['uri' => 'https://yourwordpress.com', 'title' => 'WordPress Calendar']], (isset($quicklinks) ? $quicklinks : []));
                        if (!empty($quicklinks)) {

OR in the controller you could change:

        $this->set(
            'quicklinks',
            $this->Staff->getQuickLinks($this->Session->read('blesta_staff_id'), $this->company_id)
        );

To something like this:

        $this->set(
            'quicklinks',
            array_merge(
                [(object)['uri' => 'https://yourwordpress.com', 'title' => 'WordPress Calendar']],
                $this->Staff->getQuickLinks($this->Session->read('blesta_staff_id'), $this->company_id)
            )
        );

 

Link to comment
Share on other sites

  • 0

Be sure you have a way to keep track of what files have custom modifications :)  That being said, there is no natural mechanism for target=blank.   You could a modify the view and change

                                    <a href="<?php $this->Html->_($quicklink->uri);?>"><?php $this->Html->_($quicklink->title);?></a>

To

                                    <a href="<?php $this->Html->_($quicklink->uri);?>"<?php $this->Html->ifSet($quicklink->external) == true ? ' target="blank"' : '';?>><?php $this->Html->_($quicklink->title);?></a>

And then add 'external' => true in the array for each of your links in the controller

Link to comment
Share on other sites

  • 0
On 10/13/2020 at 4:45 PM, Jono said:

quickink.png.90806e1f4c766f6cc11210d5452666b1.png  Visit the page and click the star icon just below the nav on the left side of the screen

 

Thanks for this topic.

For future reference for anyone else; when you add a quick link via the star icon, Blesta adds the links into the database table "staff_links". So if you need to edit them, you can do so in that table.

I had a problem whereby I had added some quick links, but subsequently changed the admin URL of Blesta and so the quick links were still using the old URLs. It was not possible to unstar existing quick links, as the linked pages were not recognised. Fortunately, it was an easy fix in the database - thanks Blesta! :blesta:

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...