|
| |
1 |
|
<?php |
|
| |
2 |
|
|
|
| |
3 |
|
function adListSubCats($ParentId, $template, $KeywordsVar = 'SearchWord') |
|
| |
4 |
|
{ |
|
| |
5 |
|
global $var_list, $m_cat_filter, $m_category_sort, $m_category_sortby, |
|
| |
6 |
|
$objCatList, $objSession,$pathtoroot, $objConfig,$admin; |
|
| |
7 |
|
|
|
| |
8 |
|
if($objCatList->NumCategories()==0) |
|
| |
9 |
|
return "<br>No Categories<br><br>"; |
|
| |
10 |
|
|
|
| |
11 |
|
$o="<table border=0 cellspacing=2 width=\"100%\"><tbody><tr>"; |
|
| |
12 |
|
|
|
| |
13 |
|
$i=1; |
|
| |
14 |
|
$list = $objSession->GetVariable($KeywordsVar); |
|
| |
15 |
|
if(strlen($list)) |
|
| |
16 |
|
$Keywords = explode(",",$list); |
|
| |
17 |
|
|
|
| |
18 |
|
$template = $pathtoroot.$admin."/templates/".$template; |
|
| |
19 |
|
|
|
| |
20 |
|
$topleft = 0; |
|
| |
21 |
|
$topright = 0; |
|
| |
22 |
|
$rightcount = 0; |
|
| |
23 |
|
$totalcats = 0; |
|
| |
24 |
|
$totalcats = $objCatList->NumItems(); |
|
| |
25 |
|
$topleft = ceil($totalcats/2); |
|
| |
26 |
|
$topright = $totalcats-$topleft; |
|
| |
27 |
|
|
|
| |
28 |
|
for ($x=0;$x<$topleft;$x++) |
|
| |
29 |
|
{ |
|
| |
30 |
|
|
|
| |
31 |
|
$cat = $objCatList->Items[$x]; |
|
| |
32 |
|
|
|
| |
33 |
|
if($cat->Get("CategoryId")!=$ParentId) |
|
| |
34 |
|
{ |
|
| |
35 |
|
if ($i > 2) |
|
| |
36 |
|
{ |
|
| |
37 |
|
$o.="</tr>\n<tr>"; |
|
| |
38 |
|
$i = 1; |
|
| |
39 |
|
} |
|
| |
40 |
|
|
|
| |
41 |
|
|
|
| |
42 |
|
if(strlen($list)) |
|
| |
43 |
|
{ |
|
| |
44 |
|
$h = $cat->AdminParseTemplate($template); |
|
| |
45 |
|
$h = HighlightKeywords($Keywords, $h); |
|
| |
46 |
|
$o .= $h; |
|
| |
47 |
|
$h = ""; |
|
| |
48 |
|
} |
|
| |
49 |
|
else |
|
| |
50 |
|
$o.=$cat->AdminParseTemplate($template); |
|
| |
51 |
|
|
|
| |
52 |
|
$i++; |
|
| |
53 |
|
} |
|
| |
54 |
|
|
|
| |
55 |
|
|
|
| |
56 |
|
if ($rightcount < $topright && (($x+$topleft) <$totalcats)) |
|
| |
57 |
|
{ |
|
| |
58 |
|
$cat = $objCatList->Items[$x+$topleft]; |
|
| |
59 |
|
if($cat->Get("CategoryId")!=$ParentId) |
|
| |
60 |
|
{ |
|
| |
61 |
|
if ($i > 2) |
|
| |
62 |
|
{ |
|
| |
63 |
|
$o.="</tr>\n<tr>"; |
|
| |
64 |
|
$i = 1; |
|
| |
65 |
|
} |
|
| |
66 |
|
|
|
| |
67 |
|
if(strlen($list)) |
|
| |
68 |
|
{ |
|
| |
69 |
|
$h = $cat->AdminParseTemplate($template); |
|
| |
70 |
|
$h = HighlightKeywords($Keywords, $h); |
|
| |
71 |
|
$o .= $h; |
|
| |
72 |
|
$h = ""; |
|
| |
73 |
|
} |
|
| |
74 |
|
else |
|
| |
75 |
|
$o.=$cat->AdminParseTemplate($template); |
|
| |
76 |
|
|
|
| |
77 |
|
$i++; |
|
| |
78 |
|
} |
|
| |
79 |
|
$rightcount++; |
|
| |
80 |
|
} |
|
| |
81 |
|
} |
|
| |
82 |
|
$o .="\n</tr></tbody></table>\n"; |
|
| |
83 |
|
return $o; |
|
| |
84 |
|
} |
|
| |
85 |
|
|
|
| |
86 |
|
function list_custom($c,$Type) |
|
| |
87 |
|
{ |
|
| |
88 |
|
global $objSession, $objCustomFieldList, $objCustomDataList, |
|
| |
89 |
|
$imagesURL; |
|
| |
90 |
|
|
|
| |
91 |
|
$field_list = $objCustomFieldList->Query_CustomField("Type=$Type"); |
|
| |
92 |
|
|
|
| |
93 |
|
if (count($field_list) == 0) |
|
| |
94 |
|
return "No Custom Fields<br><br>"; |
|
| |
95 |
|
|
|
| |
96 |
|
$o=""; |
|
| |
97 |
|
|
|
| |
98 |
|
$i = 1; |
|
| |
99 |
|
$objCustomDataList->SourceTable = $objSession->GetEditTable("CustomMetaData"); |
|
| |
100 |
|
$objCustomDataList->LoadResource($c->Get("ResourceId")); |
|
| |
101 |
|
foreach($field_list as $field) |
|
| |
102 |
|
{ |
|
| |
103 |
|
$fieldname = $field->Get("FieldName"); |
|
| |
104 |
|
$fieldlabel = $field->Get("FieldLabel"); |
|
| |
105 |
|
$fieldid = $field->Get("CustomFieldId"); |
|
| |
106 |
|
|
|
| |
107 |
|
$f = $objCustomDataList->GetDataItem($fieldid); |
|
| |
108 |
|
if(is_object($f)) |
|
| |
109 |
|
{ |
|
| |
110 |
|
$fieldvalue = $f->Get("Value"); |
|
| |
111 |
|
} |
|
| |
112 |
|
else |
|
| |
113 |
|
$fieldvalue=""; |
|
| |
114 |
|
$o .="<tr " . int_table_color_ret() .">"; |
|
| |
115 |
|
$o .="<td valign=\"top\"><img src=\"$imagesURL/itemicons/icon16_custom.gif\" height=\"16\" width=\"16\" align=\"absmiddle\"><span class=\"text\"> $fieldname</span></td> |
|
| |
116 |
|
<td valign=\"top\"><span class=\"text\">$fieldlabel</span></td> |
|
| |
117 |
|
<td> |
|
| |
118 |
|
<input type=\"text\" name=\"customdata[$fieldid]\" class=\"text\" size=\"30\" value=\"$fieldvalue\"> |
|
| |
119 |
|
</td></tr>\n"; |
|
| |
120 |
|
|
|
| |
121 |
|
$i++; |
|
| |
122 |
|
} |
|
| |
123 |
|
return $o; |
|
| |
124 |
|
} |
|
| |
125 |
|
|
|
| |
126 |
|
|
|
| |
127 |
|
function adListRelatedCategories($Item) |
|
| |
128 |
|
{ |
|
| |
129 |
|
global $objCatList; |
|
| |
130 |
|
|
|
| |
131 |
|
if(is_object($Item)) |
|
| |
132 |
|
{ |
|
| |
133 |
|
$catlist = $Item->GetRelatedCategories(0); |
|
| |
134 |
|
$o = ""; |
|
| |
135 |
|
foreach($catlist as $catrel) |
|
| |
136 |
|
{ |
|
| |
137 |
|
$o .= "<input type=checkbox NAME=\"dellist[]\" VALUE=\"".$catrel->Get("RelationshipId")."\">"; |
|
| |
138 |
|
$cat = $objCatList->GetByResource($catrel->Get("TargetId")); |
|
| |
139 |
|
$o .= $cat->GetCachedNavBar(); |
|
| |
140 |
|
$o .="<br>\n"; |
|
| |
141 |
|
} |
|
| |
142 |
|
} |
|
| |
143 |
|
return $o; |
|
| |
144 |
|
} |
|
| |
145 |
|
|
|
| |
146 |
|
function adListRelatedItems($Item) |
|
| |
147 |
|
{ |
|
| |
148 |
|
global $objCatList; |
|
| |
149 |
|
|
|
| |
150 |
|
if(is_object($Item)) |
|
| |
151 |
|
{ |
|
| |
152 |
|
$item_list=$Item->GetRelatedItems(0); |
|
| |
153 |
|
$o = ""; |
|
| |
154 |
|
foreach($item_list as $i) |
|
| |
155 |
|
{ |
|
| |
156 |
|
$data = $i->GetTargetItemData(); |
|
| |
157 |
|
$o .= "<tr ".int_table_color_ret().">"; |
|
| |
158 |
|
$o .= "<TD>"; |
|
| |
159 |
|
$o .= "<input type=checkbox NAME=\"dellist[]\" VALUE=\"".$i->Get("RelationshipId")."\">"; |
|
| |
160 |
|
$o .= $data[$data["TitleField"]]; |
|
| |
161 |
|
$o .= "</TD>"; |
|
| |
162 |
|
$o .= "<TD>".$data["SourceTable"]."</TD>"; |
|
| |
163 |
|
$cat =& $objCatList->GetCategory($data["CategoryId"]); |
|
| |
164 |
|
$o .= "<TD>"; |
|
| |
165 |
|
$o .= $cat->GetCachedNavBar(); |
|
| |
166 |
|
$o .= "</TD></TR>"; |
|
| |
167 |
|
} |
|
| |
168 |
|
} |
|
| |
169 |
|
return $o; |
|
| |
170 |
|
} |
|
| |
171 |
|
|
|
| |
172 |
|
function adListItemReviews($Item) |
|
| |
173 |
|
{ |
|
| |
174 |
|
global $pathtoroot,$admin; |
|
| |
175 |
|
|
|
| |
176 |
|
$Reviews = $Item->GetItemReviews(); |
|
| |
177 |
|
$o = ""; |
|
| |
178 |
|
if($Reviews->ItemCount()>0) |
|
| |
179 |
|
{ |
|
| |
180 |
|
foreach($Reviews->ItemList as $r) |
|
| |
181 |
|
{ |
|
| |
182 |
|
$o .= "<TR ".int_table_color_ret().">"; |
|
| |
183 |
|
$o .= "<TD width=\"5%\">"; |
|
| |
184 |
|
if($r->Get("Pending")==0) |
|
| |
185 |
|
{ |
|
| |
186 |
|
$o .= "<INPUT TYPE=checkbox NAME=\"deletelist[]\" VALUE=\"".$r->Get("ReviewId")."\"> Delete"; |
|
| |
187 |
|
} |
|
| |
188 |
|
$o .= "</TD><TD width=\"5%\">"; |
|
| |
189 |
|
if($r->Get("Pending")!=0) |
|
| |
190 |
|
{ |
|
| |
191 |
|
$o .= "<INPUT TYPE=checkbox NAME=\"approvelist[]\" VALUE=\"".$r->Get("ReviewId")."\"> Approve"; |
|
| |
192 |
|
} |
|
| |
193 |
|
$o .= "</TD>"; |
|
| |
194 |
|
$o .= $r->parse_template(admintemplate($pathtoroot.$admin."/templates/review_element.tpl")); |
|
| |
195 |
|
$o .= "</TR>"; |
|
| |
196 |
|
} |
|
| |
197 |
|
} |
|
| |
198 |
|
return $o; |
|
| |
199 |
|
} |
|
| |
200 |
|
|
|
| |
201 |
|
|
|
| |
202 |
|
function adImageUploadFormTags($img) |
|
| |
203 |
|
{ |
|
| |
204 |
|
static $file_count=0; |
|
| |
205 |
|
|
|
| |
206 |
|
$o = ""; |
|
| |
207 |
|
if($file_count==0) |
|
| |
208 |
|
{ |
|
| |
209 |
|
$o .= "<INPUT TYPE=HIDDEN NAME=\"img\" VALUE=1>"; |
|
| |
210 |
|
} |
|
| |
211 |
|
$o .= "<TD><INPUT TYPE=TEXT NAME=\"img_Name_$file_count\" VALUE=\"".$img->Get("Name")."\"></TD>"; |
|
| |
212 |
|
$o .= "<TD><INPUT TYPE=TEXT NAME=\"img_Alt_$file_count\" VALUE=\"".$img->Get("AltName")."\"></TD>"; |
|
| |
213 |
|
$o .= "<TD>"; |
|
| |
214 |
|
|
|
| |
215 |
|
$o .= "<INPUT TYPE=TEXT size=40 NAME=\"img_Url_$file_count\" VALUE=\"".$img->Get("Url")."\">"; |
|
| |
216 |
|
$o .= "</TD><TD>"; |
|
| |
217 |
|
$o .= "<INPUT TYPE=FILE class=\"button\" VALUE=\"".$img->Get("Url")."\" NAME=\"$file_count\">"; |
|
| |
218 |
|
|
|
| |
219 |
|
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Res_$file_count\" VALUE=\"".$img->Get("ResourceId")."\">"; |
|
| |
220 |
|
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Rel_$file_count\" VALUE=\"".$img->Get("RelatedTo")."\">"; |
|
| |
221 |
|
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_Thumb_$file_count\" VALUE=\"".$img->Get("IsThumbnail")."\">"; |
|
| |
222 |
|
$parts = pathinfo($img->Get("LocalPath")); |
|
| |
223 |
|
$destdir = $parts["dirname"]; |
|
| |
224 |
|
|
|
| |
225 |
|
$o .= "<INPUT TYPE=HIDDEN NAME=\"img_DestDir_$file_count\" VALUE=\"$destdir\">"; |
|
| |
226 |
|
if($img->Get("RelatedTo")>0) |
|
| |
227 |
|
$o .= "<input type=\"submit\" name=\"img_Del_$file_count\" value=\"Delete\" class=\"button2\">"; |
|
| |
228 |
|
$o .= "</TD>"; |
|
| |
229 |
|
$file_count++; |
|
| |
230 |
|
return $o; |
|
| |
231 |
|
} |
|
| |
232 |
|
|
|
| |
233 |
|
function m_GetModuleInfo($info_type) |
|
| |
234 |
|
{ |
|
| |
235 |
|
|
|
| |
236 |
|
switch($info_type) |
|
| |
237 |
|
{ |
|
| |
238 |
|
case 'rel_list': |
|
| |
239 |
|
return Array( 'MainTable' => 'Category', 'ItemNameField' => 'CachedNavbar', |
|
| |
240 |
|
'ItemNamePhrase' => 'la_Text_Category', 'TargetType' => 1); |
|
| |
241 |
|
break; |
|
| |
242 |
|
|
|
| |
243 |
|
case 'summary_pending': |
|
| |
244 |
|
global $imagesURL; |
|
| |
245 |
|
$ret = Array(); |
|
| |
246 |
|
|
|
| |
247 |
|
$UserURL = $GLOBALS['adminURL'].'/users/user_list.php?env='.BuildEnv(); |
|
| |
248 |
|
|
|
| |
249 |
|
|
|
| |
250 |
|
$ret[] = Array( 'link' => "config_val('User_View', '4' ,'$UserURL')", |
|
| |
251 |
|
'icon_image' => $imagesURL.'/itemicons/icon16_user_pending.gif', |
|
| |
252 |
|
'phrase' => 'la_Text_Users', 'list_var_name' => 'objUsers' ); |
|
| |
253 |
|
|
|
| |
254 |
|
|
|
| |
255 |
|
$ret[] = Array( 'link' => "PendingLink('category','Category_View',41)", |
|
| |
256 |
|
'icon_image' => $imagesURL.'/itemicons/icon16_cat_pending.gif', |
|
| |
257 |
|
'phrase' => 'la_tab_Categories', 'list_var_name' => 'objCatList'); |
|
| |
258 |
|
|
|
| |
259 |
|
return $ret; |
|
| |
260 |
|
break; |
|
| |
261 |
|
|
|
| |
262 |
|
case 'all_bitmask': |
|
| |
263 |
|
return Array('VarName' => 'Category_View', 'Bits' => 127); |
|
| |
264 |
|
break; |
|
| |
265 |
|
|
|
| |
266 |
|
case 'dupe_resourceids': |
|
| |
267 |
|
$ret=Array(); |
|
| |
268 |
|
$ret[]=Array('Table'=>'Category','IDField'=>'CategoryId'); |
|
| |
269 |
|
$ret[]=Array('Table'=>'PortalGroup','IDField'=>'GroupId'); |
|
| |
270 |
|
$ret[]=Array('Table'=>'PortalUser','IDField'=>'PortalUserId'); |
|
| |
271 |
|
return $ret; |
|
| |
272 |
|
break; |
|
| |
273 |
|
|
|
| |
274 |
|
case 'filenames': |
|
| |
275 |
|
return Array('prefix' => 'm', 'table' => 'Category', 'id_field' => 'CategoryId', 'title_field' => 'Name'); |
|
| |
276 |
|
break; |
|
| |
277 |
|
} |
|
| |
278 |
|
|
|
| |
279 |
|
return false; |
|
| |
280 |
|
} |
|
| |
281 |
|
|
|
| |
282 |
|
?> |