<div dir="ltr">Do you see "<b><u><i>Widgets</i></u></b>" module in settings in our Yetiforce?<div><a href="https://test.yetiforce.com/index.php?module=Widgets&parent=Settings&view=Index&block=2&fieldid=58">https://test.yetiforce.com/index.php?module=Widgets&parent=Settings&view=Index&block=2&fieldid=58</a><br></div></div><div class="gmail_extra"><br clear="all"><div><div><br></div><div><div>Z poważaniem / Regards</div><div>Błażej Pabiszczak</div><div>M: +48.884999123<br>E: <a href="mailto:b.pabiszczak@opensaas.pl" target="_blank">b.pabiszczak@opensaas.pl</a></div></div></div>
<br><div class="gmail_quote">2014-10-13 15:31 GMT+02:00 IT-Solutions4You <span dir="ltr"><<a href="mailto:info@its4you.sk" target="_blank">info@its4you.sk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And what's now? How can we (community) help vtiger to implement this:<br>
<br>
<a href="https://discussions.vtiger.com/index.php?p=/discussion/171186/detail-view-widgets-implementation/p1" target="_blank">https://discussions.vtiger.<u></u>com/index.php?p=/discussion/<u></u>171186/detail-view-widgets-<u></u>implementation/p1</a><br>
<br>
Matus.<br>
<br>
Dňa 13. 10. 2014 13:04 Alan Lord wrote / napísal(a):<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ah,<br>
<br>
I think you might be right about vtiger_links & DETALVIEWWIDGETS...<br>
<br>
I've started looking at creating a module which allows the user to add a<br>
custom widget to other modules via my extension module...<br>
<br>
But looking at the code in the standard models in<br>
/modules/Vtiger/models/{<u></u>Detail.php,DetailView.php} it looks like<br>
getDetailViewLinks() and getWidgets() will only *ever* return specific<br>
widgets and will override information in the vtiger_links table such as<br>
linkurl for example.<br>
<br>
Is this really the case or am I missing something? Is there no way for<br>
me to add a new entry in the vtiger_links table such that, for example,<br>
I could add a new "Libertus" widget that gets displayed on the Contacts<br>
module Summary page or DetailView page?<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/**<br>
* Function to get the detail view links (links and widgets)<br>
* @param <array> $linkParams - parameters which will be used to<br>
calicaulate the params<br>
* @return <array> - array of link models in the format as below<br>
* array('linktype'=>list of link models);<br>
*/<br>
public function getDetailViewLinks($<u></u>linkParams) {<br>
$linkTypes = array('DETAILVIEWBASIC','<u></u>DETAILVIEW');<br>
$moduleModel = $this->getModule();<br>
$recordModel = $this->getRecord();<br>
<br>
$moduleName = $moduleModel->getName();<br>
$recordId = $recordModel->getId();<br>
<br>
$detailViewLink = array();<br>
<br>
if(Users_Privileges_Model::<u></u>isPermitted($moduleName,<br>
'EditView', $recordId)) {<br>
$detailViewLinks[] = array(<br>
'linktype' => 'DETAILVIEWBASIC',<br>
'linklabel' => 'LBL_EDIT',<br>
'linkurl' => $recordModel->getEditViewUrl()<u></u>,<br>
'linkicon' => ''<br>
);<br>
<br>
foreach ($detailViewLinks as $detailViewLink) {<br>
$linkModelList['<u></u>DETAILVIEWBASIC'][] =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>detailViewLink);<br>
}<br>
}<br>
<br>
$linkModelListDetails =<br>
Vtiger_Link_Model::<u></u>getAllByType($moduleModel-><u></u>getId(),$linkTypes,$<u></u>linkParams);<br>
<br>
//Mark all detail view basic links as detail view links.<br>
//Since ui will be look ugly if you need many basic links<br>
$detailViewBasiclinks = $linkModelListDetails['<u></u>DETAILVIEWBASIC'];<br>
unset($linkModelListDetails['<u></u>DETAILVIEWBASIC']);<br>
<br>
if(Users_Privileges_Model::<u></u>isPermitted($moduleName, 'Delete',<br>
$recordId)) {<br>
$deletelinkModel = array(<br>
'linktype' => 'DETAILVIEW',<br>
'linklabel' => sprintf("%s %s",<br>
getTranslatedString('LBL_<u></u>DELETE', $moduleName), vtranslate('SINGLE_'.<br>
$moduleName, $moduleName)),<br>
'linkurl' =><br>
'javascript:Vtiger_Detail_Js.<u></u>deleteRecord("'.$recordModel-><u></u>getDeleteUrl().'")',<br>
<br>
'linkicon' => ''<br>
);<br>
$linkModelList['DETAILVIEW'][] =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>deletelinkModel);<br>
}<br>
<br>
if(Users_Privileges_Model::<u></u>isPermitted($moduleName,<br>
'EditView', $recordId)) {<br>
$duplicateLinkModel = array(<br>
'linktype' => 'DETAILVIEWBASIC',<br>
'linklabel' => 'LBL_DUPLICATE',<br>
'linkurl' =><br>
$recordModel-><u></u>getDuplicateRecordUrl(),<br>
'linkicon' => ''<br>
);<br>
$linkModelList['DETAILVIEW'][] =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>duplicateLinkModel);<br>
}<br>
<br>
if(!empty($<u></u>detailViewBasiclinks)) {<br>
foreach($detailViewBasiclinks as $linkModel) {<br>
// Remove view history, needed in vtiger5 to see<br>
history but not in vtiger6<br>
if($linkModel->linklabel == 'View History') {<br>
continue;<br>
}<br>
$linkModelList['DETAILVIEW'][] = $linkModel;<br>
}<br>
}<br>
<br>
$relatedLinks = $this-><u></u>getDetailViewRelatedLinks();<br>
<br>
foreach($relatedLinks as $relatedLinkEntry) {<br>
$relatedLink =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>relatedLinkEntry);<br>
$linkModelList[$relatedLink-><u></u>getType()][] = $relatedLink;<br>
}<br>
<br>
$widgets = $this->getWidgets();<br>
foreach($widgets as $widgetLinkModel) {<br>
$linkModelList['<u></u>DETAILVIEWWIDGET'][] = $widgetLinkModel;<br>
}<br>
<br>
$currentUserModel = Users_Record_Model::<u></u>getCurrentUserModel();<br>
if($currentUserModel-><u></u>isAdminUser()) {<br>
$settingsLinks = $moduleModel->getSettingLinks(<u></u>);<br>
foreach($settingsLinks as $settingsLink) {<br>
$linkModelList['<u></u>DETAILVIEWSETTING'][] =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>settingsLink);<br>
}<br>
}<br>
<br>
return $linkModelList;<br>
}<br>
</blockquote>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
/**<br>
* Function to get the detail view widgets<br>
* @return <Array> - List of widgets , where each widget is an<br>
Vtiger_Link_Model<br>
*/<br>
public function getWidgets() {<br>
$moduleModel = $this->getModule();<br>
$widgets = array();<br>
<br>
$modCommentsModel =<br>
Vtiger_Module_Model::<u></u>getInstance('ModComments');<br>
if($moduleModel-><u></u>isCommentEnabled() &&<br>
$modCommentsModel-><u></u>isPermitted('DetailView')) {<br>
$widgets[] = array(<br>
'linktype' => 'DETAILVIEWWIDGET',<br>
'linklabel' => 'ModComments',<br>
'linkurl' =><br>
'module='.$this-><u></u>getModuleName().'&view=Detail&<u></u>record='.$this->getRecord()-><u></u>getId().<br>
<br>
'&mode=showRecentComments&<u></u>page=1&limit=5'<br>
);<br>
}<br>
<br>
if($moduleModel-><u></u>isTrackingEnabled()) {<br>
$widgets[] = array(<br>
'linktype' => 'DETAILVIEWWIDGET',<br>
'linklabel' => 'LBL_UPDATES',<br>
'linkurl' =><br>
'module='.$this-><u></u>getModuleName().'&view=Detail&<u></u>record='.$this->getRecord()-><u></u>getId().<br>
<br>
'&mode=showRecentActivities&<u></u>page=1&limit=5',<br>
);<br>
}<br>
<br>
$widgetLinks = array();<br>
foreach ($widgets as $widgetDetails) {<br>
$widgetLinks[] =<br>
Vtiger_Link_Model::<u></u>getInstanceFromValues($<u></u>widgetDetails);<br>
}<br>
return $widgetLinks;<br>
}<br>
</blockquote>
<br>
Al<br>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a></blockquote></div><br></div>