turner2f Posted October 13, 2020 Report Posted October 13, 2020 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 ? ... Quote
0 turner2f Posted October 13, 2020 Author Report Posted October 13, 2020 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 ? ... Quote
0 Jono Posted October 13, 2020 Report Posted October 13, 2020 Visit the page and click the star icon just below the nav on the left side of the screen turner2f 1 Quote
0 turner2f Posted October 13, 2020 Author Report Posted October 13, 2020 @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> ... Quote
0 Jono Posted October 14, 2020 Report Posted October 14, 2020 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) ) ); domaingood 1 Quote
0 turner2f Posted October 14, 2020 Author Report Posted October 14, 2020 @Jono Thanks for the tip. I will try it out . Quote
0 turner2f Posted November 10, 2020 Author Report Posted November 10, 2020 @Jono Works great. How do we make it so that the "target" is "Blank" ? ( target="_blank" ) =================== Look forward to your reply. Jono 1 Quote
0 Jono Posted November 10, 2020 Report Posted November 10, 2020 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 Quote
0 turner2f Posted November 11, 2020 Author Report Posted November 11, 2020 @Jono I apologize. I should have mentioned that the file I was needing to alter is . . . " admin_main.pdt " Found at: blesta/app/views/admin/default/admin_main.pdt How do I modify that particular file so that it has a ( target="_blank" ) for the custom Quick links ? Quote
0 Jono Posted November 11, 2020 Report Posted November 11, 2020 Yup, my response applies to that file and the admin_main.php controller. I believe that is line 33 in the admin_main.pdt view file Quote
0 Alk Posted July 31, 2021 Report Posted July 31, 2021 On 10/13/2020 at 4:45 PM, Jono said: 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! Jono 1 Quote
Question
turner2f
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 ?
...
10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.