-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature.php
101 lines (78 loc) · 3.74 KB
/
feature.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/*------------------------------------------------------------------------
# Music Addon
# ------------------------------------------------------------------------
# Author: DuongTVTemPlaza
# Copyright: Copyright (C) 2016 tzportfolio.com. All Rights Reserved.
# @License - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Website: http://www.tzportfolio.com
# Technical Support: Forum - http://tzportfolio.com/forum
# Family website: http://www.templaza.com
-------------------------------------------------------------------------*/
// No direct access
defined('_JEXEC') or die;
class PlgTZ_Portfolio_PlusContentFeature extends TZ_Portfolio_PlusPlugin
{
protected $autoloadLanguage = true;
public function onContentAfterSave($context, $data, $isnew){
if($context == 'com_tz_portfolio_plus.article' || $context == 'com_tz_portfolio_plus.form') {
if($model = $this -> getModel($this -> _name, 'TZ_Portfolio_Plus_Addon_'.$this -> _name.'Model')) {
if(method_exists($model,'save')) {
if(isset($this -> _myFormDataBeforeSave) && !empty($this -> _myFormDataBeforeSave)){
$addon = TZ_Portfolio_PlusPluginHelper::getPlugin($this -> _type, $this -> _name);
$mydata = array('value' => $this -> _myFormDataBeforeSave);
if(!empty($addon) && isset($addon -> id)){
$mydata['extension_id'] = $addon -> id;
if(!empty($data) && isset($data -> id)){
$mydata['content_id'] = $data -> id;
}
$mydata['published'] = 1;
$model->save( $mydata);
}
}
}
}
}
}
public function onAfterDisplayAdditionInfo($context, &$article, $params, $page = 0, $layout = 'default'
, $module = null){
list($extension, $vName) = explode('.', $context);
$item = $article;
if ($extension == 'module' || $extension == 'modules') {
if ($path = $this->getModuleLayout($this->_type, $this->_name, $extension, $vName, $layout)) {
// Display html
ob_start();
include $path;
$html = ob_get_contents();
ob_end_clean();
$html = trim($html);
return $html;
}
}elseif(in_array($context, array('com_tz_portfolio_plus.portfolio', 'com_tz_portfolio_plus.date'
, 'com_tz_portfolio_plus.featured', 'com_tz_portfolio_plus.tags', 'com_tz_portfolio_plus.users'))){
if($html = $this -> _getViewHtml($context,$item, $params)){
return $html;
}
}
}
/*
* Register form with position to article form
* @article: the article data.
* Return form with position:
* -title: title of form to display in article form
* -html: html of form to display in article form
* -position: position (description, before_description or after_description) to display in article form
* */
// public function onAddFormBeforeArticleDescription($article = null){
// $position = $this -> __addFormToPosition($article);
// return $position;
// }
// public function onAddFormAfterArticleDescription($article = null){
// $position = $this -> __addFormToPosition($article);
// return $position;
// }
public function onAddFormToArticleDescription($article = null){
$position = $this -> __addFormToPosition($article);
return $position;
}
}